The Zipkin exporter only supports traces. For metrics and logs, use the OTLP exporter.
Installation
Add the dependency to yourCargo.toml:
Feature Flags
Default features (blocking HTTP client):Quick Start
1. Run Zipkin
Start Zipkin using Docker:http://localhost:9411
2. Basic Setup
3. View Traces
Openhttp://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 tohttp://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 endpointOTEL_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: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
-
Verify Zipkin is running:
-
Check endpoint configuration:
- Default:
http://localhost:9411/api/v2/spans - Ensure no typos in custom endpoints
- Default:
-
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
- 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
| Feature | Zipkin Exporter | OTLP Exporter |
|---|---|---|
| Traces | ✓ | ✓ |
| Metrics | ✗ | ✓ |
| Logs | ✗ | ✓ |
| Protocol | HTTP/JSON | gRPC, HTTP/protobuf, HTTP/JSON |
| Maintenance | Active | Active |
| Use Case | Zipkin backends | Universal |
Next Steps
OTLP Exporter
Export all signals with OTLP
Tracing Guide
Learn about distributed tracing