Skip to content

Commit

Permalink
HTTP blackhole: fix bytes_received and requests_received metrics (#…
Browse files Browse the repository at this point in the history
…711)

* Un-flip bytes_received and requests_received metrics

Co-authored-by: Scott Opell <scott.opell@datadoghq.com>

* changelog

---------

Co-authored-by: Scott Opell <scott.opell@datadoghq.com>
  • Loading branch information
GeorgeHahn and scottopell authored Oct 17, 2023
1 parent a24a8ac commit c4ced6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed
- Correct metrics emitted by http blackhole

## [0.19.0]
### Changed
- HTTP blackhole can respond with arbitrary data.
Expand Down
4 changes: 2 additions & 2 deletions lading/src/blackhole/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async fn srv(
req: Request<Body>,
headers: HeaderMap,
) -> Result<Response<Body>, hyper::Error> {
bytes_received.increment(1);
requests_received.increment(1);

let (parts, body) = req.into_parts();

Expand All @@ -126,7 +126,7 @@ async fn srv(
match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), bytes) {
Err(response) => Ok(response),
Ok(body) => {
requests_received.increment(body.len() as u64);
bytes_received.increment(body.len() as u64);

let mut okay = Response::default();
*okay.status_mut() = status;
Expand Down

0 comments on commit c4ced6e

Please sign in to comment.