#metrics-exporter #datadog #compatible #tokio #send

metrics-datadog-exporter

A metrics compatible exporter that sends metrics to DataDog

14 releases

0.1.14 Nov 20, 2023
0.1.13 Aug 19, 2022
0.1.11 May 19, 2022
0.1.10 Feb 16, 2022
0.1.2 May 21, 2021

#19 in #datadog

Download history 75/week @ 2024-07-22 184/week @ 2024-07-29 171/week @ 2024-08-05 122/week @ 2024-08-12 45/week @ 2024-08-19 26/week @ 2024-08-26 4/week @ 2024-09-02 22/week @ 2024-09-09 50/week @ 2024-09-16 235/week @ 2024-09-23 24/week @ 2024-09-30 49/week @ 2024-10-07 33/week @ 2024-10-14 59/week @ 2024-10-21 16/week @ 2024-10-28 48/week @ 2024-11-04

158 downloads per month

MIT license

27KB
593 lines

metrics-datadog-exporter

Crates.io docs.rs GitHub Workflow Status

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

Usage

Writing to stdout

#[tokio::main]
async fn main() {
    let exporter = DataDogBuilder::default()
        .tags(vec![
            "tag1".to_string(),
            "val1".to_string()
        ])
        .build()
        .install()
        .unwrap();
    exporter.flush.await()?;
}

Writing to API

#[tokio::main]
async fn main() {
    let exporter = DataDogBuilder::default()
        .write_to_stdout(false)
        .write_to_api(true, Some("DD_API_KEY".to_string()))
        .tags(vec![
            "tag1".to_string(),
            "val1".to_string()
        ])
        .build()
        .install()
        .unwrap();
    exporter.flush.await()?;
}

Writing on a schedule

#[tokio::main]
async fn main() {
    let exporter = DataDogBuilder::default()
        .write_to_stdout(false)
        .write_to_api(true, Some("DD_API_KEY".to_string()))
        .tags(vec![
            "tag1".to_string(),
            "val1".to_string()
        ])
        .build()
        .install()
        .unwrap();
    let (_exporter, _scheduled) = exporter.schedule(Duration::from_secs(10));
}

Dependencies

~10–23MB
~322K SLoC