metrics-exporter-influx

Crates.iometrics-exporter-influx
lib.rsmetrics-exporter-influx
version0.1.3
sourcesrc
created_at2023-07-05 20:50:37.542004
updated_at2023-10-24 19:48:59.865245
descriptionA metrics-compatible exporter for sending metrics to Influx/Grafana Cloud
homepagehttps://github.com/sevco/metrics-exporter-influx
repositoryhttps://github.com/sevco/metrics-exporter-influx
max_upload_size
id909354
size61,235
Nick Murdock (nmurdock80)

documentation

README

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

use std::time::Duration;

#[tokio::main]
async fn main() {
    InfluxBuilder::new().with_duration(Duration::from_secs(60)).install()?;
}

Writing to a file

use std::fs::File;

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

Writing to http

Influx

#[tokio::main]
async fn main() {
    InfluxBuilder::new()
        .with_influx_api(
            "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.

#[tokio::main]
async fn main() {
    InfluxBuilder::new()
        .with_grafna_cloud_api(
            "https://https://influx-prod-03-prod-us-central-0.grafana.net/api/v1/push/influx/write",
            Some("username".to_string()),
            Some("key")
        )
        .install()?;
}
Commit count: 17

cargo fmt