async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

provide information about various timings (queue, connect, ...) to user via delegate (or otherwise)

Open weissi opened this issue 2 months ago • 5 comments

With AsyncHTTPClient, the user currently struggles to calculate some timings. For example what's impossible to calculate accurately at the moment is:

  • How long did this request spend in the connection pool queue
  • How long did it take to make a connection (if one didn't already exist)
  • How long did it take to send the request
  • DNS timings

These should be available to a user.

weissi avatar Nov 05 '25 11:11 weissi

Would it be enough for you if we expose these by adding traces for the individual timings and metrics?

FranzBusch avatar Nov 05 '25 14:11 FranzBusch

Would it be enough for you if we expose these by adding traces for the individual timings and metrics?

No. These ought to be either observable (by giving the user enough "hooks" in the delegate) or pre-calculated for the user. I think giving the user enough hooks is preferable over calculating a bunch of stuff and surfacing numbers.

weissi avatar Nov 05 '25 14:11 weissi

Would it be enough for you if we expose these by adding traces for the individual timings and metrics?

No. These ought to be either observable (by giving the user enough "hooks" in the delegate) or pre-calculated for the user. I think giving the user enough hooks is preferable over calculating a bunch of stuff and surfacing numbers.

Seems reasonable but I am would be curious if you have a use-case in mind for these timings besides reporting them to an observability system? Do you intend to steer behavior of an application depending on those timings?

FranzBusch avatar Nov 05 '25 15:11 FranzBusch

Would it be enough for you if we expose these by adding traces for the individual timings and metrics?

No. These ought to be either observable (by giving the user enough "hooks" in the delegate) or pre-calculated for the user. I think giving the user enough hooks is preferable over calculating a bunch of stuff and surfacing numbers.

Seems reasonable but I am would be curious if you have a use-case in mind for these timings besides reporting them to an observability system? Do you intend to steer behavior of an application depending on those timings?

Today's use case is a parity question. An existing system reports this information to its clients (honestly, don't know what they do with it, maybe better error messages?) and URLSession allows you to calculate it -- AHC doesn't.

weissi avatar Nov 05 '25 15:11 weissi

Also terminal output like curl etc can do needs timing in a way that tracing etc should not be used.

weissi avatar Nov 06 '25 18:11 weissi