Open kolesnikovae opened 1 year ago
If you don't mind letting *resty.Client
from https://github.com/go-resty/resty replace *http.Client
I think this can be done rather painlessly and nicely. If so I can try a PR.
As of now pyroscope-go
has zero dependencies and is very lightweight. I'm not very sure if adding resty
(which is primarily a very feature-rich REST client) exclusively for a basic retry mechanism is worth it
Hi @kolesnikovae. Yes, that would be a shame for sure. I know there is some subtlety with retries and trying to use the same connection that one would hope resty
deals with (but I haven't actually read the code), but that is probably over thinking it.
Hashicorp's package retryablehttp is pretty lightweight in terms of deps.
Requests failed with codes 5xx and 429 (rate limited) should be retried with exponential backoff interval and max number of attempts per request.