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.
src/opentelemetry/ext/zipkin
tests
CHANGELOG.md
README.rst
setup.cfg
setup.py

README.rst

OpenTelemetry Zipkin Exporter

pypi

This library allows to export tracing data to Zipkin.

Installation

pip install opentelemetry-ext-zipkin

Usage

The OpenTelemetry Zipkin Exporter allows to export OpenTelemetry traces to Zipkin. This exporter always send traces to the configured Zipkin collector using HTTP.

from opentelemetry import trace
from opentelemetry.ext import zipkin
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 ZipkinSpanExporter
zipkin_exporter = zipkin.ZipkinSpanExporter(
    service_name="my-helloworld-service",
    # optional:
    # host_name="localhost",
    # port=9411,
    # endpoint="/api/v2/spans",
    # protocol="http",
    # ipv4="",
    # ipv6="",
    # retry=False,
)

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

# add to the tracer
trace.tracer_source().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.