#open-telemetry #influx-db #metrics #integration #system #provider #meter

influxive

High-level Rust integration of opentelemetry metrics and InfluxDB

11 releases

0.0.3-alpha.1 Jun 5, 2024
0.0.2-alpha.1 Oct 16, 2023
0.0.1-alpha.11 Aug 4, 2023
0.0.1-alpha.9 Jul 31, 2023

#291 in Development tools

Download history 478/week @ 2024-07-25 588/week @ 2024-08-01 389/week @ 2024-08-08 335/week @ 2024-08-15 392/week @ 2024-08-22 570/week @ 2024-08-29 586/week @ 2024-09-05 626/week @ 2024-09-12 756/week @ 2024-09-19 479/week @ 2024-09-26 482/week @ 2024-10-03 382/week @ 2024-10-10 398/week @ 2024-10-17 573/week @ 2024-10-24 572/week @ 2024-10-31 547/week @ 2024-11-07

2,209 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

84KB
2K SLoC

Project Forum Chat

License: MIT License: Apache-2.0

High-level Rust integration of opentelemetry metrics and InfluxDB.

Examples

Easy, zero-configuration InfluxDB as a child process

let tmp = tempfile::tempdir().unwrap();

// create our meter provider
let (_influxive, meter_provider) = influxive::influxive_child_process_meter_provider(
    influxive::InfluxiveChildSvcConfig::default()
        .with_database_path(Some(tmp.path().to_owned())),
    influxive::InfluxiveMeterProviderConfig::default(),
).await.unwrap();

// register our meter provider
opentelemetry_api::global::set_meter_provider(meter_provider);

// create a metric
let m = opentelemetry_api::global::meter("my.meter")
    .f64_histogram("my.metric")
    .init();

// make a recording
m.record(3.14, &[]);

Connecting to an already running InfluxDB system process

// create our meter provider
let meter_provider = influxive::influxive_external_meter_provider_token_auth(
    influxive::InfluxiveWriterConfig::default(),
    influxive::InfluxiveMeterProviderConfig::default(),
    "http://127.0.0.1:8086",
    "my.bucket",
    "my.token",
);

// register our meter provider
opentelemetry_api::global::set_meter_provider(meter_provider);

// create a metric
let m = opentelemetry_api::global::meter("my.meter")
    .f64_histogram("my.metric")
    .init();

// make a recording
m.record(3.14, &[]);

Dependencies

~10–22MB
~315K SLoC