diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4ec3b35..9fdc4dc76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Added - Parse nearly the complete field list of smaps/smaps_rollup in the Linux observer. - Metrics storage is now generational, expiring unwritten metrics by configuration parameter `expiration`. +- Requests sent to the 'http' blackhole will now record the `path` of the HTTP + request as a tag of the `bytes_received` and `requests_received` metrics. ## Removed - Removed the unused target-rss-byte-limit from the command line, internal stub of. ## Changed diff --git a/lading/src/blackhole/http.rs b/lading/src/blackhole/http.rs index dc5d65ffc..c45140e57 100644 --- a/lading/src/blackhole/http.rs +++ b/lading/src/blackhole/http.rs @@ -127,15 +127,18 @@ struct KinesisPutRecordBatchResponse { #[allow(clippy::borrow_interior_mutable_const)] async fn srv( status: StatusCode, - metric_labels: Vec<(String, String)>, + mut metric_labels: Vec<(String, String)>, body_bytes: Vec, req: Request, headers: HeaderMap, response_delay: Duration, ) -> Result, hyper::Error> { - counter!("requests_received", &metric_labels).increment(1); - let (parts, body) = req.into_parts(); + if let Some(path_and_query) = parts.uri.path_and_query() { + metric_labels.push(("path".to_string(), path_and_query.path().to_string())); + } + + counter!("requests_received", &metric_labels).increment(1); let bytes = body.collect().await?.to_bytes();