Skip to content

Commit

Permalink
review: simplify RecordBodyData<S> response
Browse files Browse the repository at this point in the history
Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn committed Nov 15, 2024
1 parent 7731f96 commit 76f1f6d
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions linkerd/http/prom/src/body_data/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,9 @@ where

let Self { inner, metrics } = self;
let metrics = metrics.clone();
let instrument = Box::new(|resp| Self::instrument_response(resp, metrics));

inner.call(req).map_ok(instrument).boxed()
}
}

impl<S> RecordBodyData<S> {
fn instrument_response<B>(resp: Response<B>, metrics: BodyDataMetrics) -> Response<BoxBody>
where
B: Body + Send + 'static,
B::Data: Send + 'static,
B::Error: Into<Error>,
{
resp.map(|b| super::body::Body::new(b, metrics))
.map(BoxBody::new)
inner
.call(req)
.map_ok(|rsp| rsp.map(|b| BoxBody::new(super::body::Body::new(b, metrics))))
.boxed()
}
}

0 comments on commit 76f1f6d

Please sign in to comment.