{"id":2653,"library":"opentelemetry-propagator-jaeger","title":"OpenTelemetry Jaeger Propagator","description":"The `opentelemetry-propagator-jaeger` library provides a `TextMapPropagator` implementation for context propagation using the Jaeger trace context format. It enables OpenTelemetry applications to send and receive trace context information to/from services that use Jaeger's native propagation format. It is part of the broader OpenTelemetry Python project, which releases frequently, typically every few weeks, bringing updates to API, SDK, and contrib packages.","status":"active","version":"1.41.0","language":"en","source_language":"en","source_url":"https://github.com/open-telemetry/opentelemetry-python","tags":["opentelemetry","tracing","jaeger","observability","propagator","distributed-tracing"],"install":[{"cmd":"pip install opentelemetry-propagator-jaeger","lang":"bash","label":"Install Jaeger Propagator"},{"cmd":"pip install 'opentelemetry-sdk' 'opentelemetry-api' 'opentelemetry-exporter-otlp'","lang":"bash","label":"Install core OTel components (recommended)"}],"dependencies":[{"reason":"Required by all OpenTelemetry components for core API interfaces.","package":"opentelemetry-api","optional":false},{"reason":"Needed for a functional OpenTelemetry setup (TracerProvider, etc.).","package":"opentelemetry-sdk","optional":true}],"imports":[{"symbol":"JaegerPropagator","correct":"from opentelemetry.propagators.jaeger import JaegerPropagator"}],"quickstart":{"code":"from opentelemetry import trace\nfrom opentelemetry.propagate import set_global_textmap\nfrom opentelemetry.propagators.jaeger import JaegerPropagator\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor\n\n# 1. Set up a TracerProvider (required for actual tracing)\nresource = Resource.create({\"service.name\": \"my-jaeger-service\"})\ntracer_provider = TracerProvider(resource=resource)\nsimple_processor = SimpleSpanProcessor(ConsoleSpanExporter())\ntracer_provider.add_span_processor(simple_processor)\ntrace.set_tracer_provider(tracer_provider)\n\n# 2. Register the JaegerPropagator globally\nset_global_textmap(JaegerPropagator())\n\n# 3. Get a tracer\ntracer = trace.get_tracer(__name__)\n\n# 4. Create a span and demonstrate context propagation (conceptually)\nwith tracer.start_as_current_span(\"my-jaeger-span\") as span:\n    print(f\"Current span ID: {span.context.span_id:x}\")\n    print(f\"Current trace ID: {span.context.trace_id:x}\")\n    # In a real application, context would be injected/extracted over network requests.\n    # For example, injecting into a dictionary for a mock HTTP request:\n    carrier = {}\n    JaegerPropagator().inject(carrier)\n    print(f\"Injected context: {carrier}\")\n\nprint(\"JaegerPropagator registered and used for context injection.\")","lang":"python","description":"This quickstart demonstrates how to initialize the `JaegerPropagator` and register it as the global text map propagator. This tells OpenTelemetry to use Jaeger's specific header format (e.g., `uber-trace-id` or `jaeger-trace-id`) when injecting and extracting trace context from HTTP headers or other text-based carriers. It includes a basic setup for a `TracerProvider` to make the example runnable and illustrate how context would be injected."},"warnings":[{"fix":"Ensure `from opentelemetry.propagate import set_global_textmap; set_global_textmap(JaegerPropagator())` is called early in your application's startup process.","message":"Forgetting to register the propagator globally. The `JaegerPropagator` must be registered using `set_global_textmap(JaegerPropagator())` for it to be used automatically by OpenTelemetry's context propagation mechanisms (e.g., in HTTP instrumentations). If not set, OpenTelemetry will default to using `W3CTraceContextPropagator` and `W3CBaggagePropagator`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `from opentelemetry.propagate import CompositePropagator, set_global_textmap; set_global_textmap(CompositePropagator([JaegerPropagator(), W3CTraceContextPropagator(), W3CBaggagePropagator()]))` to support multiple propagation formats.","message":"Mixing Jaeger and W3C Trace Context. Jaeger uses a specific header format (`uber-trace-id`, `jaeger-trace-id`). W3C Trace Context uses `traceparent` and `tracestate`. If your system interacts with services using both, you'll need to use a `CompositePropagator` to handle multiple formats.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review any code that explicitly checks for `INVALID_SPAN` when no SDK is installed or that relies on `NoOpTracer` not propagating context. Adjust logic to account for context propagation even without an SDK if a valid context is present.","message":"Changes to `NoOpTracer` behavior in `opentelemetry-sdk` v1.40.0. The `start_span` and `start_as_current_span` methods in `NoOpTracer` no longer strictly return an `INVALID_SPAN` if there is a valid span context as the current span context. Instead, they propagate the span context properly even without the SDK installed. While this is a core SDK change, it's relevant if your application logic or testing relies on the previous `NoOpTracer` behavior when no SDK is configured, which could subtly impact how propagators perceive the 'current' context.","severity":"breaking","affected_versions":">=1.40.0"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}