Registry /
observability / opentelemetry-exporter-jaeger
Install & Compatibility
Where this runs
tested against v1.21.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 51.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.3s · import 0.000s · 46MB
46MB installed
● package 46MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
JaegerExporter
✓ from opentelemetry.exporter.jaeger.thrift import JaegerExporter
Used for sending spans to a Jaeger Agent via UDP (default). This is the classic Jaeger exporter.
JaegerHttpExporter
✓ from opentelemetry.exporter.jaeger.thrift import JaegerHttpExporter
Used for sending spans to a Jaeger Collector via HTTP (Thrift over HTTP).
TracerProvider
✓ from opentelemetry.sdk.trace import TracerProvider
BatchSpanProcessor
✓ from opentelemetry.sdk.trace.export import BatchSpanProcessor
Resource
✓ from opentelemetry.sdk.resources import Resource
SERVICE_NAME
✓ from opentelemetry.sdk.resources import SERVICE_NAME
This quickstart demonstrates how to set up the OpenTelemetry Python SDK with the Jaeger Exporter. It initializes a `TracerProvider` with a `BatchSpanProcessor` and configures the `JaegerExporter` to send traces to a local Jaeger agent via UDP. Resource attributes, particularly `SERVICE_NAME`, are crucial for identifying your service in Jaeger. Environment variables are used for agent host/port to simplify configuration.
import os
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource, SERVICE_NAME
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
# Configure resource for your service
resource = Resource.create({
SERVICE_NAME: os.environ.get('OTEL_SERVICE_NAME', 'my-jaeger-service'),
})
# Configure TracerProvider
provider = TracerProvider(resource=resource)
# Configure Jaeger Exporter (UDP to local agent by default)
# Use environment variables for agent host/port or pass them directly:
# JAEGER_AGENT_HOST, JAEGER_AGENT_PORT
# For HTTP Exporter, use JaegerHttpExporter and JAEGER_COLLECTOR_ENDPOINT
jaeger_exporter = JaegerExporter(
agent_host_name=os.environ.get('JAEGER_AGENT_HOST', 'localhost'),
agent_port=int(os.environ.get('JAEGER_AGENT_PORT', 6831)),
)
# Add the exporter to a BatchSpanProcessor
span_processor = BatchSpanProcessor(jaeger_exporter)
provider.add_span_processor(span_processor)
# Set the global tracer provider
trace.set_tracer_provider(provider)
# Get a tracer and create spans
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span('my-operation') as span:
span.set_attribute('event', 'started')
print(f"Hello from span: {span.context.trace_id}")
with tracer.start_as_current_span('inner-operation'):
print("Inside inner operation")
span.set_attribute('event', 'finished')
# Ensure all spans are exported before exiting
provider.force_flush()
print("Traces exported to Jaeger.")
Debug
Known issues
gotchaThe default `JaegerExporter` sends spans via UDP to a Jaeger Agent, typically on `localhost:6831`. If you need to send spans over HTTP to a Jaeger Collector, you must explicitly use `JaegerHttpExporter` and configure its endpoint.fixFor UDP, ensure a Jaeger Agent is running and accessible at the configured `agent_host_name` and `agent_port`. For HTTP, import `JaegerHttpExporter` and pass `collector_endpoint` to its constructor, e.g., `JaegerHttpExporter(collector_endpoint='http://localhost:14268/api/traces')`.
affects: All versions
gotchaProviding meaningful resource attributes, especially `SERVICE_NAME`, is critical for effectively identifying and filtering your services and applications within the Jaeger UI. Without it, all spans might appear under a generic name.fixAlways initialize `TracerProvider` with a `Resource` that includes `SERVICE_NAME`. Example: `Resource.create({SERVICE_NAME: 'my-application'})`. affects: All versions
breakingThe OpenTelemetry Python SDK, which this exporter relies on, frequently updates its API and internal behavior across major/minor versions. For example, `v1.40.0` included a fix for `NoOpTracer` behavior for `start_span` and `start_as_current_span`, which could subtly affect applications not using a full SDK setup.fixAlways refer to the official OpenTelemetry Python changelog (`opentelemetry-python` repository releases) for specific breaking changes in the SDK or API when upgrading. Ensure your `opentelemetry-sdk` and `opentelemetry-api` packages are compatible with your exporter version.
affects: Primarily `opentelemetry-sdk` v1.40.0 and newer, affecting all integrated components.
gotchaExporters typically use environment variables (e.g., `OTEL_EXPORTER_JAEGER_AGENT_HOST`, `OTEL_EXPORTER_JAEGER_AGENT_PORT`, `OTEL_EXPORTER_JAEGER_ENDPOINT`) for configuration when using auto-instrumentation or `configure_opentelemetry()`. Programmatic configuration, as shown in the quickstart, will override these.fixBe mindful of your configuration source. For consistent behavior, choose either environment variables (often for simpler deployments/auto-instrumentation) or programmatic setup, but avoid mixing them in ways that lead to unexpected overrides. Ensure explicit programmatic settings align with your intent.
affects: All versions
Upgrade
Version history
1.21.0latest on PyPI · released Nov 7, 2023
Audit
Dependencies
No dependency data recorded yet.