Follow up to "Add `aroundRequest` directive which captures complete request / response processing duration"

Hi all,

My colleagues and I have been looking into ways to capture metrics around request/response processing in akka-http.

Following from issue #2216 and taking into account the 3rd party attempts linked in the description I opened a PR last year. Taking on board comments in the PR I then tried a new approach and it can be found in a branch on my fork here:

As per the description it takes into regard:

  • sending request and response entity out
  • timeouts
  • exceptions / rejections

Note: As the custom function is applied in the ControllerStage of HttpServerBluePrint.scala it is assumed that timeouts/exceptions/rejections have already been handled upstream.

I have the following questions:

1. Does the approach taken in the branch linked above meet the requirements outlined in the issue?

  • If not, any guidance would be appreciated.

2. Is there a place to add a hook to capture the last-byte time?

  • The current approach captures first-byte time on non chunked responses and first-byte of last chunk on chunked responses.

All feedback is appreciated,