Added simple retry logic for failed post requests (#560) #561
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.
Summary
Added a for loop in the PostHelper method to retry the request if the first request failed due to an IO exception, it'd try 3 more times with a 50ms pause after each retry. If these 3 requests fails, it executes the existing failure logic. If one of these 3 requests succeeds, the for loop is broken and execution resumes as normal.
Motivation
I'm seeing failing requests to Datadog in production, and less dataloss is always something that should be desired.
Test plan
I added a print statement in my local code to print when the post failed. I routed the datadog url to localhost and got....
Ta Da!
Rollout/monitoring/revert plan
Nothing should need to be done other than watch errors drop