Skip to main content

Automatic journey_id propagation for DataFramer — inbound extraction, outbound header injection, Langfuse trace stamping

Project description

dataframer-journey

Automatic journey_id propagation for DataFramer user-signal stitching. One line per service; after that the journey id flows browser → service → service → trace without anyone threading it by hand.

Install

pip install dataframer-journey

Zero runtime dependencies. Patches apply only to libraries you already have (requests, httpx, langfuse).

Usage

FastAPI / Starlette:

from dataframer_journey import instrument

app = FastAPI()
instrument(app)

Django — call instrument() at the end of settings.py and add the middleware:

MIDDLEWARE = [
    ...,
    'dataframer_journey.django.JourneyIdMiddleware',
]

import dataframer_journey
dataframer_journey.instrument()

That's it. From then on:

  • Inbound: the journey id is read off each incoming request (baggage header → X-Journey-Id header → df_journey_id cookie set by @dataframer/signals) into request-scoped context.
  • Outbound: every outgoing requests/httpx call automatically carries it to the next service (both X-Journey-Id and W3C baggage, so it also rides existing OpenTelemetry propagation). Explicitly-set headers are never overwritten.
  • Traces: every Langfuse trace created during the request gets metadata.journey_id (and a journey:<id> tag) stamped automatically. Explicit metadata wins; the stamp is merge-if-absent.

Non-HTTP entry points (queue consumers, scheduled jobs): take the id from the payload yourself —

from dataframer_journey import with_journey, get_journey_id

with with_journey(payload["journey_id"]):
    ...  # traces created here are stamped; outbound calls carry the id

Notes

  • Langfuse SDK v2 is supported; v3 (OpenTelemetry-based) stamping is not implemented yet and logs a warning.
  • The browser side is @dataframer/signals, which generates the journey id and sends it on requests to your API.
  • CORS: if your frontend and API are on different origins, allow the X-Journey-Id (or baggage) request header in your API's CORS config. Same-site setups need nothing — the cookie carries it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataframer_journey-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataframer_journey-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file dataframer_journey-0.1.0.tar.gz.

File metadata

  • Download URL: dataframer_journey-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dataframer_journey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72240757cd4d82ce396cde613792c48bddfe0666ed0c0191d1c1439f10b9d44b
MD5 1fd91f266c9516a3d79a21c93040d9fe
BLAKE2b-256 5c26dc6f03d4751fabbcf18566c941daa3ca43c1c51c6ea9aab932d03b05a540

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataframer_journey-0.1.0.tar.gz:

Publisher: publish.yml on aimonlabs/dataframer-journey-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dataframer_journey-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dataframer_journey-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66af52e5b569eea50e0d352521892391ec1326ea6fd98cd75b26cde74e353077
MD5 820aac1d6ceeca3b740b4b61a7f161b9
BLAKE2b-256 95c69575bbda7caefc75b1cac14be5f51bf8782c19eb1de5e851037f70ccabe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataframer_journey-0.1.0-py3-none-any.whl:

Publisher: publish.yml on aimonlabs/dataframer-journey-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page