Crates.io | influxive |
lib.rs | influxive |
version | 0.0.3-alpha.1 |
source | src |
created_at | 2023-07-20 21:37:54.604839 |
updated_at | 2024-06-05 16:34:17.067953 |
description | High-level Rust integration of opentelemetry metrics and InfluxDB |
homepage | |
repository | https://github.com/holochain/influxive |
max_upload_size | |
id | 921787 |
size | 7,223 |
High-level Rust integration of opentelemetry metrics and InfluxDB.
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, &[]);
// 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, &[]);