#metrics #open-telemetry #atomic

influxive-otel-atomic-obs

Opentelemetry observable metric implementations based on std::sync::atomic types

9 releases

0.0.5 Aug 12, 2025
0.0.4-alpha.1 Feb 19, 2025
0.0.3-alpha.1 Jun 5, 2024
0.0.2-alpha.1 Oct 16, 2023
0.0.1-alpha.9 Jul 31, 2023

#541 in Debugging

Download history 616/week @ 2025-07-11 716/week @ 2025-07-18 457/week @ 2025-07-25 434/week @ 2025-08-01 629/week @ 2025-08-08 692/week @ 2025-08-15 515/week @ 2025-08-22 952/week @ 2025-08-29 678/week @ 2025-09-05 547/week @ 2025-09-12 704/week @ 2025-09-19 923/week @ 2025-09-26 867/week @ 2025-10-03 728/week @ 2025-10-10 678/week @ 2025-10-17 695/week @ 2025-10-24

3,205 downloads per month
Used in 19 crates (via tx5)

MIT/Apache

26KB
594 lines

Opentelemetry observable metric implementations based on std::sync::atomic types. Opentelemetry has a concept of "observable" metrics that are not reported as they are updated, but rather, when an update happens, they are polled. For ease-of-use in code, it is often desirable to have these metrics be backed by std::sync::atomic types, so that they can be easily updated throughout the code, and fetched whenever a metric reporting poll occurs. This crate provides the [MeterExt] trait and associated types to make it easy to use std::sync::atomic backed metrics with opentelemetry.

Example

use influxive_otel_atomic_obs::MeterExt;

let (my_metric, _) = opentelemetry_api::global::meter("my_meter")
    .u64_observable_gauge_atomic("my_metric", 0)
    .init();

my_metric.set(66); // probably will not be reported
my_metric.set(99); // probably will not be reported
my_metric.set(42); // will be reported next time reporting runs

Dependencies

~2–3MB
~54K SLoC