Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
examples
src/opentelemetry/ext/jaeger
tests
thrift
CHANGELOG.md
README.rst
setup.cfg
setup.py

README.rst

OpenTelemetry Jaeger Exporter

pypi

This library allows to export tracing data to Jaeger.

Installation

pip install opentelemetry-ext-jaeger

Usage

The OpenTelemetry Jaeger Exporter allows to export OpenTelemetry traces to Jaeger. This exporter always send traces to the configured agent using Thrift compact protocol over UDP. An optional collector can be configured, in this case Thrift binary protocol over HTTP is used. gRPC is still not supported by this implementation.

from opentelemetry import trace
from opentelemetry.ext import jaeger
from opentelemetry.sdk.trace import TracerSource
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor

trace.set_preferred_tracer_source_implementation(lambda T: TracerSource())
tracer = trace.get_tracer(__name__)

# create a JaegerSpanExporter
jaeger_exporter = jaeger.JaegerSpanExporter(
    service_name='my-helloworld-service',
    # configure agent
    agent_host_name='localhost',
    agent_port=6831,
    # optional: configure also collector
    # collector_host_name='localhost',
    # collector_port=14268,
    # collector_endpoint='/api/traces?format=jaeger.thrift',
    # username=xxxx, # optional
    # password=xxxx, # optional
)

# Create a BatchExportSpanProcessor and add the exporter to it
span_processor = BatchExportSpanProcessor(jaeger_exporter)

# add to the tracer
tracer.add_span_processor(span_processor)

with tracer.start_as_current_span('foo'):
    print('Hello world!')

The examples folder contains more elaborated examples.

References

You can’t perform that action at this time.