This library allows to export tracing data to Zipkin using JSON for serialization. It is part of the OpenTelemetry Python project, which releases frequently (typically monthly or bi-monthly). The current version is 1.41.0.
pip install opentelemetry-exporter-zipkin-json opentelemetry-sdk requestsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up the OpenTelemetry Python SDK with the Zipkin JSON Exporter. It initializes a TracerProvider, configures the ZipkinExporter to send traces to a default or environment-variable-defined endpoint, and uses a BatchSpanProcessor for efficient trace export. Finally, it creates a simple span and ensures proper shutdown.
Always set the 'service.name' attribute when initializing the TracerProvider's Resource, e.g., `Resource.create({"service.name": "my-app-name"})`.Enable OpenTelemetry debug logging (`OTEL_PYTHON_LOG_LEVEL=DEBUG`) and monitor exporter logs for errors. Verify the Zipkin collector is running and accessible at the configured endpoint (e.g., `http://localhost:9411/api/v2/spans`).
Ensure all spans are properly ended. Use `with tracer.start_as_current_span(...)` or explicitly call `span.end()`. Always configure the SDK with a `BatchSpanProcessor` for production environments.
Verify the `endpoint` URL matches your Zipkin collector's configuration, including the full path. Use the `OTEL_EXPORTER_ZIPKIN_ENDPOINT` environment variable or pass the `endpoint` argument directly to `ZipkinExporter`.