hashicorp / hashicorp/go-retryablehttp

Measure latency/request duration and provide it for logging purpose

Open
#235 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
298
PR merge metrics
No merged PRs in 30d

Description

Right now it's hardly possible to get an attempt latency for a log like `"request failed after 300ms, attempts: 3"`.
It's quite important to know how much time was actually spent per each request, since the external service can abort it at any moment. And in case the backoff didn't help -- to know the total duration in the [default error](https://github.com/hashicorp/go-retryablehttp/blob/40b0cad1633fd521cee5884724fcf03d039aaf3f/client.go#L824) within the number of attempts.

Ideally, `ResponseLogHook` could be extended with more arguments like `attemptsNumber`, `attemptLatency` (last one), `totalLatency` (sum of all attempts + delays)
All of it can be structured under some "Details" structure.

For `ErrorHandler` it could also be useful to have the final total latency.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.