25 breaking releases

0.27.0 Nov 12, 2024
0.25.0 Sep 9, 2024
0.22.0 Jul 23, 2024
0.20.0 Feb 25, 2024
0.0.1 Mar 24, 2020

#2 in #zipkin

Download history 10953/week @ 2024-08-18 12306/week @ 2024-08-25 10188/week @ 2024-09-01 13085/week @ 2024-09-08 11431/week @ 2024-09-15 12783/week @ 2024-09-22 16338/week @ 2024-09-29 15595/week @ 2024-10-06 15399/week @ 2024-10-13 16182/week @ 2024-10-20 16595/week @ 2024-10-27 15415/week @ 2024-11-03 14498/week @ 2024-11-10 16266/week @ 2024-11-17 13346/week @ 2024-11-24 19323/week @ 2024-12-01

63,748 downloads per month
Used in 14 crates (7 directly)

Apache-2.0

1.5MB
23K SLoC

OpenTelemetry Zipkin Exporter

OpenTelemetry — An observability framework for cloud-native software.

Zipkin integration for applications instrumented with OpenTelemetry.

Crates.io: opentelemetry-zipkin Documentation LICENSE GitHub Actions CI Slack

OpenTelemetry Overview

OpenTelemetry is an Observability framework and toolkit designed to create and manage telemetry data such as traces, metrics, and logs. OpenTelemetry is vendor- and tool-agnostic, meaning that it can be used with a broad variety of Observability backends, including open source tools like [Jaeger] and [Prometheus], as well as commercial offerings.

OpenTelemetry is not an observability backend like Jaeger, Prometheus, or other commercial vendors. OpenTelemetry is focused on the generation, collection, management, and export of telemetry. A major goal of OpenTelemetry is that you can easily instrument your applications or systems, no matter their language, infrastructure, or runtime environment. Crucially, the storage and visualization of telemetry is intentionally left to other tools.

Quickstart

First make sure you have a running version of the zipkin process you want to send data to:

$ docker run -d -p 9411:9411 openzipkin/zipkin

Then install a new pipeline with the recommended defaults to start exporting telemetry:

use opentelemetry::trace::Tracer;
use opentelemetry::global;

fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
    global::set_text_map_propagator(opentelemetry_zipkin::Propagator::new());
    let tracer = opentelemetry_zipkin::new_pipeline().install_simple()?;

    tracer.in_span("doing_work", |cx| {
        // Traced app logic here...
    });

    global::shutdown_tracer_provider();

    Ok(())
}

Performance

For optimal performance, a batch exporter is recommended as the simple exporter will export each span synchronously on drop. You can enable the rt-tokio, rt-tokio-current-thread or rt-async-std features and specify a runtime on the pipeline builder to have a batch exporter configured for you automatically.

[dependencies]
opentelemetry = "*"
opentelemetry_sdk = { version = "*", features = ["rt-tokio"] }
opentelemetry-zipkin = { version = "*", features = ["reqwest-client"], default-features = false }
let tracer = opentelemetry_zipkin::new_pipeline()
    .install_batch(opentelemetry_sdk::runtime::Tokio)?;

Choosing an HTTP client

The HTTP client that this exporter will use can be overridden using features or a manual implementation of the HttpClient trait. By default the reqwest-blocking-client feature is enabled which will use the reqwest crate. While this is compatible with both async and non-async projects, it is not optimal for high-performance async applications as it will block the executor thread. Consider using the reqwest-client (without blocking) if you are in the tokio ecosystem.

Note that async http clients may require a specific async runtime to be available so be sure to match them appropriately.

Kitchen Sink Full Configuration

Example showing how to override all configuration options. See the ZipkinPipelineBuilder docs for details of each option.

Supported Rust Versions

OpenTelemetry is built against the latest stable release. The minimum supported version is 1.70. The current OpenTelemetry version is not guaranteed to build on Rust versions earlier than the minimum supported version.

The current stable Rust compiler and the three most recent minor versions before it will always be supported. For example, if the current stable compiler version is 1.49, the minimum supported version will not be increased past 1.46, three minor versions prior. Increasing the minimum supported compiler version is not considered a semver breaking change as long as doing so complies with this policy.

Dependencies

~5–16MB
~200K SLoC