Skip to content

Conversation

@parsons90
Copy link
Contributor

What does this PR do?

Retries sending logs if the HTTP request failed. It will retry up to 4 times, with a 1 second timeout between retries, doubling each time. It will not retry http 4xx responses.

Motivation

The network connection can be flaky and it is worth retrying a failed request.

Testing Guidelines

Ran unit tests and tested in the Azure portal.

To test request errors, I constructed a bad http request with invalid options, and saw it attempt to retry the request. You can see the retry backoff in the timestamps.
Screen Shot 2022-07-28 at 9 13 46 AM

Retrying based on status code. It doesn't retry on a 404, but does retry with a 500.
Screen Shot 2022-07-28 at 9 51 33 AM

There was also a random timeout that got retried:
Screen Shot 2022-07-28 at 9 09 09 AM

Additional Notes

Is 4 retries too much/not enough? How is a 1 sec timeout interval? Will doubling the timeout cause it to wait too long?

Without using external libraries, the only way to add a delay is with setTimeout, which requires a callback to be provided.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)
  • This PR passes the unit tests
  • This PR passes the installation tests (ask a Datadog member to run the tests)

@parsons90 parsons90 requested a review from a team as a code owner July 28, 2022 14:09
Copy link
Contributor

@gpalmz gpalmz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe worth getting another set of eyes since we don't work on this much

@parsons90 parsons90 merged commit a1cd963 into master Aug 2, 2022
@parsons90 parsons90 deleted the AZI-529_retry_long_sender branch August 2, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants