#metrics #cloudwatch #aws

metrics_cloudwatch

CloudWatch emitter for the metrics crate

6 releases (breaking)

✓ Uses Rust 2018 edition

0.5.0 May 22, 2020
0.4.0 Mar 18, 2020
0.3.0 Feb 21, 2020
0.2.0 Feb 18, 2020
0.1.1 Feb 17, 2020

#129 in Debugging

Download history 100/week @ 2020-02-14 54/week @ 2020-02-21 28/week @ 2020-02-28 46/week @ 2020-03-06 56/week @ 2020-03-13 77/week @ 2020-03-20 28/week @ 2020-03-27 24/week @ 2020-04-03 59/week @ 2020-04-10 75/week @ 2020-04-17 71/week @ 2020-04-24 57/week @ 2020-05-01 34/week @ 2020-05-08 14/week @ 2020-05-15 39/week @ 2020-05-22

198 downloads per month

MIT/Apache

22KB
510 lines

metrics_cloudwatch

crates.io Docs Build status

Purpose

Provide a backend for the metrics facade crate, pushing metrics to CloudWatch.

How to use

Credentials for AWS needs to be available in the environment, see Rusoto docs on AWS credentials

cargo add -s metrics metrics_cloudwatch
fn main() {
    // Initialize the backend
    metrics_cloudwatch::builder()
        .cloudwatch_namespace("my-namespace")
        .init_thread()
        .unwrap();

    metrics::counter!("requests", 1);
}

Limitations

The CloudWatch metrics API imposes some limitations.

  • Max 10 labels (dimensions) per metric
  • Max 150 unique histogram values (used by timing!() and value!()) per API call. Going beyond this works but will incur one API call per batch of 150 unique values. Could be a good idea to measure timing in milliseconds rather than nanoseconds, to keep down the number of unique values.

Dependencies

~12MB
~262K SLoC