Skip to main content
The Zipkin exporter sends OpenTelemetry trace data to Zipkin, a popular distributed tracing system. Use this exporter when you have existing Zipkin infrastructure or need compatibility with Zipkin’s trace format.
The Zipkin exporter only supports traces. For metrics and logs, use the OTLP exporter.

Installation

Add the dependency to your Cargo.toml:

Feature Flags

Default features (blocking HTTP client):
Async HTTP client (recommended for async applications):
With Rustls TLS:

Quick Start

1. Run Zipkin

Start Zipkin using Docker:
Zipkin UI will be available at: http://localhost:9411

2. Basic Setup

3. View Traces

Open http://localhost:9411 in your browser to view traces in the Zipkin UI.

Complete Example

Here’s a complete example with nested spans and attributes:

Configuration

Custom Endpoint

By default, the exporter sends to http://localhost:9411/api/v2/spans. Customize the endpoint:

Service Name Configuration

Set the service name via Resource:

Environment Variables

The exporter supports these environment variables:
  • OTEL_EXPORTER_ZIPKIN_ENDPOINT - Zipkin collector endpoint
  • OTEL_SERVICE_NAME - Service name

Performance Optimization

Use Batch Exporter

For production applications, use batch processing for better performance:

Async HTTP Client

For async applications, use the non-blocking client:
No code changes needed - the async client is used automatically.

Context Propagation

Zipkin uses B3 propagation for distributing trace context across service boundaries.

Set B3 Propagator

Injecting Context (Outgoing Requests)

Extracting Context (Incoming Requests)

Integration Examples

With Actix-Web

With Tokio

Troubleshooting

Traces Not Appearing

  1. Verify Zipkin is running:
  2. Check endpoint configuration:
    • Default: http://localhost:9411/api/v2/spans
    • Ensure no typos in custom endpoints
  3. Ensure shutdown is called:

Missing Span Attributes

Attributes must be set before the span ends:

Context Not Propagating

Ensure the Zipkin propagator is set:

When to Use Zipkin Exporter

Use Zipkin exporter when:
  • You have existing Zipkin infrastructure
  • You need B3 propagation compatibility
  • You’re integrating with Zipkin-native tools
  • You’re migrating gradually from Zipkin to OpenTelemetry
Use OTLP exporter when:
  • Starting a new project
  • You need metrics and logs in addition to traces
  • You want vendor-neutral telemetry
  • You need maximum flexibility in backend choice

Zipkin vs OTLP

Next Steps

OTLP Exporter

Export all signals with OTLP

Tracing Guide

Learn about distributed tracing