Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
strategy:
matrix:
msrv: [1.90]
msrv: [1.84]
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v0.9.0 (2026-01-17)
* Update lambda_http dependency contributed by Roger Wilson (CaptainJiNX)
* Correctly error and not block if there is an attempt to send more than 100 histogram values before flushing contributed by Aaron1011
(Aaron1011)
* MSRV increased to 1.84
* Updated tower to 0.5.3

## v0.8.0 (2025-06-22)
* Update lambda_http dependency contributed by Roger Wilson (CaptainJiNX)

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "metrics_cloudwatch_embedded"
version = "0.8.0"
version = "0.9.0"
authors = ["brianmorin <brianrossmorin@gmail.com>"]
edition = "2021"
rust-version = "1.90"
rust-version = "1.84"

description = "CloudWatch embedded metrics format emitter for the metrics crate"
license = "Apache-2.0"
Expand Down Expand Up @@ -31,7 +31,7 @@ metrics = "0.24"
pin-project = { version = "1", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tower = { version = "0.5.2", optional = true }
tower = { version = "0.5.3", optional = true }
tracing = "0.1"
futures = "0.3"
bytes = "1"
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ metrics

AWS Lambda Example
------------------
The [Lambda Runtime](https://crates.io/crates/lambda-runtime) intergration feature handles flushing metrics
The [Lambda Runtime](https://crates.io/crates/lambda-runtime) integration feature handles flushing metrics
after each invoke via either `run()` alternatives or `MetricService` which implements the
[`tower::Service`](https://crates.io/crates/tower) trait.

It also provides optional helpers for:
* emiting a metric on cold starts
* emitting a metric on cold starts
* wrapping cold starts in a [`tracing`](https://crates.io/crates/tracing) span
* decorating metric documents with request id and/or x-ray trace id

In your Cargo.toml add:
```toml
metrics = "0.24"
metrics_cloudwatch_embedded = { version = "0.8.0", features = ["lambda"] }
metrics_cloudwatch_embedded = { version = "0.9.0", features = ["lambda"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "env-filter", "json"] }
```

Expand Down Expand Up @@ -121,7 +121,7 @@ more than 30 dimensions/labels will fail with an error via the `tracing` crate
Supported Rust Versions (MSRV)
------------------------------

This crate requires a minimum of Rust 1.90, and is not guaranteed to build on compiler versions earlier than that.
This crate requires a minimum of Rust 1.84, and is not guaranteed to build on compiler versions earlier than that.

License
-------
Expand All @@ -139,3 +139,9 @@ 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

Continuation/Abandonment
-------------------------

I grant permission for Amazon Web Services (https://github.com/aws) to take over this project if I
am no longer able to maintain it or have abandoned it.
35 changes: 35 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,39 @@ mod tests {
);
}
}

rusty_fork_test! {
#[test]
fn too_many_histogram_values() {
use std::sync::mpsc;
use std::time::Duration;

let (tx, rx) = mpsc::channel();
std::thread::spawn(move || {
let port = format!("{}", 7779);
let metrics = builder::Builder::new()
.cloudwatch_namespace("namespace")
.with_dimension("Address", "10.172.207.225")
.with_dimension("Port", port)
.with_timestamp(1687657545423)
.emit_zeros(true)
.init()
.unwrap();

metrics::describe_counter!("success", metrics::Unit::Count, "");
metrics::describe_histogram!("runtime", metrics::Unit::Milliseconds, "");

for _ in 0..200 {
metrics::histogram!("runtime", "module" => "directory", "api" => "a_function").record(4.0);
}

let mut output = Vec::new();
metrics.flush(&mut output).unwrap();
tx.send(()).unwrap();
});

rx.recv_timeout(Duration::from_secs(3))
.expect("Test timed out after 3 seconds");
}
}
}