#influxive #atomic #metrics #otel #obs #observable

influxive-otel-atomic-obs

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

6 releases

0.0.2-alpha.1 Oct 16, 2023
0.0.1-alpha.11 Aug 4, 2023
0.0.1-alpha.10 Aug 1, 2023
0.0.1-alpha.9 Jul 31, 2023
0.0.1-alpha.8 Jul 28, 2023

#2 in #influxive

Download history 499/week @ 2023-11-07 493/week @ 2023-11-14 581/week @ 2023-11-21 420/week @ 2023-11-28 487/week @ 2023-12-05 507/week @ 2023-12-12 453/week @ 2023-12-19 291/week @ 2023-12-26 276/week @ 2024-01-02 589/week @ 2024-01-09 469/week @ 2024-01-16 545/week @ 2024-01-23 596/week @ 2024-01-30 822/week @ 2024-02-06 377/week @ 2024-02-13 457/week @ 2024-02-20

2,311 downloads per month
Used in 23 crates (2 directly)

MIT/Apache

26KB
574 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.1–3MB
~57K SLoC