From 6170f75cc251ec3ab5e39ea4b00cd7be56f62591 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 17 Dec 2024 11:04:37 -0800 Subject: [PATCH 1/3] Adjust how `bytes_received` is calculated in the HTTP blackhole This commit adjusts `bytes_received` to measure the bytes received over the wire before decoding. This allows lading to make assertions about the efficacy of compression by targets, matching the behavior of the other lading blackholes. We preserve the decoded metric by renaming it `decoded_bytes_received`. Signed-off-by: Brian L. Troutwine --- lading/src/blackhole/http.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lading/src/blackhole/http.rs b/lading/src/blackhole/http.rs index dc5d65ffc..9cca66763 100644 --- a/lading/src/blackhole/http.rs +++ b/lading/src/blackhole/http.rs @@ -138,11 +138,12 @@ async fn srv( let (parts, body) = req.into_parts(); let bytes = body.collect().await?.to_bytes(); + counter!("bytes_received", &metric_labels).increment(bytes.len() as u64); match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), bytes) { Err(response) => Ok(response), Ok(body) => { - counter!("bytes_received", &metric_labels).increment(body.len() as u64); + counter!("decoded_bytes_received", &metric_labels).increment(body.len() as u64); tokio::time::sleep(response_delay).await; From d409e7561f39b28b1b889d3f9acfec97d8ba19e8 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 17 Dec 2024 11:13:15 -0800 Subject: [PATCH 2/3] changelog Signed-off-by: Brian L. Troutwine --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ed2d564..fa14e3db6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +## Changed +- The `bytes_received` metric in the HTTP blackhole now tracks raw bytes, the + former metric is preserved with `decoded_bytes_received`. + ## [0.25.1] ## Removed - Revert PR #1148 From d1982cdd6fd004c42873b73677bb193abe05eeef Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 17 Dec 2024 11:15:37 -0800 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Scott Opell --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa14e3db6..e9050011c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## Changed -- The `bytes_received` metric in the HTTP blackhole now tracks raw bytes, the +- The `bytes_received` metric in the HTTP blackhole now tracks wire bytes, the former metric is preserved with `decoded_bytes_received`. ## [0.25.1]