#datadog #metrics #exporter

metrics-datadog-exporter

A metrics compatible exporter that sends metrics to DataDog

13 releases

Uses new Rust 2021

0.1.13 Aug 19, 2022
0.1.12 Aug 17, 2022
0.1.11 May 19, 2022
0.1.10 Feb 16, 2022
0.1.2 May 21, 2021
Download history 144/week @ 2022-10-07 322/week @ 2022-10-14 230/week @ 2022-10-21 187/week @ 2022-10-28 228/week @ 2022-11-04 68/week @ 2022-11-11 108/week @ 2022-11-18 91/week @ 2022-11-25 124/week @ 2022-12-02 77/week @ 2022-12-09 147/week @ 2022-12-16 53/week @ 2022-12-23 62/week @ 2022-12-30 134/week @ 2023-01-06 131/week @ 2023-01-13 296/week @ 2023-01-20

626 downloads per month

MIT license

25KB
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

~9–17MB
~333K SLoC