grafana / pyroscope-go

This is the golang client integration for Pyroscope
Apache License 2.0
104 stars 19 forks source link

Retry on failed upload #46

Open kolesnikovae opened 1 year ago

kolesnikovae commented 1 year ago

Requests failed with codes 5xx and 429 (rate limited) should be retried with exponential backoff interval and max number of attempts per request.

craigpastro commented 11 months 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.

kolesnikovae commented 11 months ago

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

craigpastro commented 11 months ago

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.

mohammed90 commented 11 months ago

Hashicorp's package retryablehttp is pretty lightweight in terms of deps.