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
158 downloads per month
27KB
593 lines
metrics-datadog-exporter
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