metrics_cloudwatch_embedded
The interface is not stable
This is a Minimum Viable Product for feedback, experimentation and iteration
Purpose
Provide a backend for the metrics facade crate,
to emit metrics in CloudWatch Embedded Metrics Format
Simple Example
let metrics = new
    .cloudwatch_namespace
    .init
    .unwrap;
increment_counter!;
metrics
    .set_property
    .flush;
AWS Lambda Example
The Lambda Runtime intergration feature handles flushing metrics after each invoke via either run()
alternatives or MetricService which inplements the tower::Service trait.
It also provides optional helpers for emiting a metric on cold starts and decorating metric documents with
request id and/or x-ray trace id.
In your Cargo.toml add:
 = {   = "0.3",  = ["lambda"] }
use ;
use run;
use ;
async 
async 
Limitations
- Histograms retain up to 100 values (the maximum for a single metric document) between calls to
collector::Collector::flush, overflow will report an error via thetracingcrate
- Dimensions set at initialization via Builder::with_dimension(...)may not overlap with metriclabels
- Only the subset of metric units in metrics::Unitare supported https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html
- Registering different metric types with the same metrics::Keywill fail with an error via thetracingcrate
- The Embedded Metric Format supports a maximum of 30 dimensions per metric, attempting to register a metric with
more than 30 dimensions/labels will fail with an error via the tracingcrate
Thanks
- Simon Andersson (ramn) and contributors - For the metrics_cloudwatch crate I used as a reference
- Toby Lawrence (tobz) - For answering my metrics crate questions before I even had something working