Skip to main content

opentelemetry-zipkin

Version: 0.31.0 The opentelemetry-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 client
  • reqwest-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/spans
fn(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 single b3 header
  • MultipleHeader: Use multiple X-B3-* headers (default)

Custom HTTP Client

You can provide a custom HTTP client by implementing the HttpClient 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

Implement HttpClient trait for full control over HTTP requests.

Documentation

Full API Documentation

View complete API reference on docs.rs

Zipkin Documentation

Official Zipkin documentation

Minimum Rust Version

MSRV: 1.75.0