You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to measure how long successful requests take, in order to calibrate my timeout so that only the slowest 5% of requests time out. If retry is disabled that's easy - simply record Date.now() before calling fetch() and then subtract it from Date.now() after the response is received. However if retry is enabled I can't figure out a way to measure the duration of the ultimately successful try.
The onRetry() callback is invoked before the sleep for the retry delay, so there's no way to measure how long the request actually took without including the retry delay, especially if the randomize retry option is enabled.
When
When retry is enabled
Where
n/a
How
Current Behavior
No way to measure successful request try duration if there were retries.
Expected Behavior
Somehow I would like this to be possible. For example perhaps we could add duration or startedAt to the returned response object?
Who
n/a
References
n/a
The text was updated successfully, but these errors were encountered:
Just noticed the x-fetch-attempts header - something like that could work as an interface for this - e.g. a new header x-fetch-started-at or x-fetch-duration.
What / Why
I want to measure how long successful requests take, in order to calibrate my timeout so that only the slowest 5% of requests time out. If retry is disabled that's easy - simply record
Date.now()
before callingfetch()
and then subtract it fromDate.now()
after the response is received. However if retry is enabled I can't figure out a way to measure the duration of the ultimately successful try.The
onRetry()
callback is invoked before the sleep for the retry delay, so there's no way to measure how long the request actually took without including the retry delay, especially if therandomize
retry option is enabled.When
When retry is enabled
Where
How
Current Behavior
No way to measure successful request try duration if there were retries.
Expected Behavior
Somehow I would like this to be possible. For example perhaps we could add
duration
orstartedAt
to the returned response object?Who
References
The text was updated successfully, but these errors were encountered: