Perform retries for certain HTTP status codes when submitting metrics to Datadog API #1359
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This proposes adding some retries when Datadog responds with certain status codes. We're using Datadog API reporter and it is frequent to have some transient failures, which is the motivation for these changes.
I've also considered dealing with some
Failure
s but, besides making testing harder, it is also not clear if those correspond to situations where the server did not receive the request at all and, thus, we might be duplicating data.So, having retries only for the success case of the request and work with HTTP status codes seemed more sensible.
What do you think, does this make sense?