opentelemetry-zipkin
Version: 0.31.0 Theopentelemetry-zipkin crate exports trace data to Zipkin using the Zipkin v2 JSON format over HTTP.
Installation
Feature Flags
reqwest-blocking-client: Use reqwest blocking HTTP client (enabled by default)reqwest-client: Use reqwest async HTTP clientreqwest-rustls: Use rustls for TLS with reqwest
Quick Start
Start Zipkin
Basic Usage
With Batch Exporter
For better performance in production, use a batch span processor:Configuration
Exporter Builder
struct
Exports spans to Zipkin in v2 JSON format
struct
Builder for configuring the Zipkin exporter
Configuration Methods
fn(String) -> Self
Set the Zipkin collector endpoint URL. Default:
http://localhost:9411/api/v2/spansfn(SocketAddr) -> Self
Set the local service address to report in spans
fn(HttpClient) -> Self
Provide a custom HTTP client implementation
Propagator
struct
B3 propagator for Zipkin trace context
enum
B3 propagation encoding format:
SingleHeader: Use singleb3headerMultipleHeader: Use multipleX-B3-*headers (default)
Custom HTTP Client
You can provide a custom HTTP client by implementing theHttpClient trait:
Error Handling
enum
Errors that can occur during exporter construction
Environment Variables
The Zipkin exporter does not use environment variables for configuration. All settings must be configured programmatically via the builder.View Traces
After exporting traces, view them in the Zipkin UI:HTTP Client Options
Reqwest Blocking (Default)
Reqwest Async
For async applications using Tokio:Custom Client
ImplementHttpClient trait for full control over HTTP requests.
Related Crates
- opentelemetry - Core API
- opentelemetry-sdk - SDK implementation
- opentelemetry-http - HTTP utilities
Documentation
Full API Documentation
View complete API reference on docs.rs
Zipkin Documentation
Official Zipkin documentation