10 releases (6 breaking)

new 0.23.0 May 15, 2024
0.22.1 Feb 26, 2024
0.21.2 Jan 4, 2024
0.21.1 Nov 13, 2023
0.1.0 Jun 27, 2019

#154 in Debugging

Download history 302672/week @ 2024-01-24 304949/week @ 2024-01-31 313544/week @ 2024-02-07 303765/week @ 2024-02-14 338607/week @ 2024-02-21 351656/week @ 2024-02-28 357574/week @ 2024-03-06 358339/week @ 2024-03-13 342145/week @ 2024-03-20 362058/week @ 2024-03-27 365191/week @ 2024-04-03 358321/week @ 2024-04-10 382020/week @ 2024-04-17 386323/week @ 2024-04-24 372594/week @ 2024-05-01 315748/week @ 2024-05-08

1,533,456 downloads per month
Used in 352 crates (93 directly)

Apache-2.0

1MB
18K SLoC

OpenTelemetry Rust SDK

OpenTelemetry — An observability framework for cloud-native software.

This crate contains the OpenTelemetry SDK implementation for Rust.

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

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.

Compiler support: requires rustc 1.65+

What does this crate contain?

This crate is official SDK implementation of OpenTelemetry encompassing several aspects of OpenTelemetry, such as context management and propagation, logging, tracing, and metrics. It follows the OpenTelemetry specification. Here's a breakdown of its components:

  • Propagators Implementation: While the opentelemetry crate contained the API, this crate contains the actual implementation.
  • Logs SDK: Implements the Logs SDK specification.
  • Tracing SDK: Implements the Tracing SDK specification.
  • Metrics SDK: Implements the Metrics SDK specification.

This crate lights up the telemetry, by replacing the facade or no-op implementation from opentelemetry crate. In many ways, one can think of opentelemetry as the crate containing the "traits" along with a no-op implementation, and this (opentelemetry-sdk) crate containing a real implementation to replace the default no-ops.

This crate defines the telemetry pipeline, and makes telemetry available for processors etc., but the actual exporting of telemetry requires additional crates, such as opentelemetry-stdout, opentelemetry-otlp etc.

Unless you are a plugin (custom Samplers, Processors etc.) author, you will almost always need to use additional crates along with this. Given this crate has no exporting capability, an OpenTelemetry Exporter is almost always required. OpenTelemetry provides the following exporters:

OpenTelemetry Rust also has a contrib repo, where additional exporters could be found. Check OpenTelemetry Registry for additional exporters and other related components as well.

Getting started

See docs.

Supported Rust Versions

OpenTelemetry is built against the latest stable release. The minimum supported version is 1.65. 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

~1–16MB
~182K SLoC