Skip to content

[FEATURE] Add way to measure request duration if retry is enabled #16

@rpaterson

Description

@rpaterson

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 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions