metrics-exporter-influx

build-badge downloads-badge release-badge docs-badge license-badge

Metrics reporter for https://github.com/metrics-rs/metrics that writes to InfluxDB.

Usage

Configuration

Writing to a stderr

```rust use std::time::Duration;

[tokio::main]

async fn main() { InfluxBuilder::new().withduration(Duration::fromsecs(60)).install()?; } ```

Writing to a file

```rust use std::fs::File;

[tokio::main]

async fn main() { InfluxBuilder::new() .with_writer(File::create("/tmp/out.metrics")?) .install()?; }

```

Writing to http

Influx

```rust

[tokio::main]

async fn main() { InfluxBuilder::new() .withinfluxapi( "http://localhost:8086", "db/rp", None, None, None, Some("ns".to_string()) ) .install()?; } ```

Grafana Cloud

Grafana Cloud supports the Influx Line Protocol exported by this exporter.

```rust

[tokio::main]

async fn main() { InfluxBuilder::new() .withgrafnacloudapi( "https://https://influx-prod-03-prod-us-central-0.grafana.net/api/v1/push/influx/write", Some("username".tostring()), Some("key") ) .install()?; } ```