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

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

#12 in #datadog

Download history 2/week @ 2023-12-11 1/week @ 2023-12-25 50/week @ 2024-01-08 13/week @ 2024-01-22 12/week @ 2024-01-29 37/week @ 2024-02-05 8/week @ 2024-02-12 31/week @ 2024-02-19 62/week @ 2024-02-26 67/week @ 2024-03-04 101/week @ 2024-03-11 103/week @ 2024-03-18 70/week @ 2024-03-25

342 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–24MB
~359K SLoC