diff --git a/lading/src/blackhole/http.rs b/lading/src/blackhole/http.rs index a627ff925..6c3d1690f 100644 --- a/lading/src/blackhole/http.rs +++ b/lading/src/blackhole/http.rs @@ -3,9 +3,6 @@ //! ## Metrics //! //! `bytes_received`: Total bytes received -//! `bytes_received_distr`: Distribution of compressed bytes per request (with `path` label) -//! `decoded_bytes_received`: Total decoded bytes received -//! `decoded_bytes_received_distr`: Distribution of decompressed bytes per request (with `path` label) //! `requests_received`: Total requests received //! @@ -13,7 +10,7 @@ use bytes::Bytes; use http::{HeaderMap, header::InvalidHeaderValue, status::InvalidStatusCode}; use http_body_util::{BodyExt, combinators::BoxBody}; use hyper::{Request, Response, StatusCode, header}; -use metrics::{counter, histogram}; +use metrics::counter; use serde::{Deserialize, Serialize}; use std::{net::SocketAddr, time::Duration}; use tracing::error; @@ -154,23 +151,18 @@ async fn srv( ) -> Result>, hyper::Error> { counter!("requests_received", &metric_labels).increment(1); - let path = req.uri().path().to_string(); - + // Split into parts let (parts, body) = req.into_parts(); + // Convert the `Body` into `Bytes` let body: Bytes = body.boxed().collect().await?.to_bytes(); counter!("bytes_received", &metric_labels).increment(body.len() as u64); - let mut labels_with_path = metric_labels.clone(); - labels_with_path.push(("path".to_string(), path)); - histogram!("bytes_received_distr", &labels_with_path).record(body.len() as f64); - match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), body) { Err(response) => Ok(*response), Ok(body) => { counter!("decoded_bytes_received", &metric_labels).increment(body.len() as u64); - histogram!("decoded_bytes_received_distr", &labels_with_path).record(body.len() as f64); tokio::time::sleep(response_delay).await;