Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exponential back-off for retrying transport errors to metrics store #549

Merged

Conversation

dliappis
Copy link
Contributor

Introduce exponential back-off mechanism for waiting between retries
when TransportErrors occurs towards the metrics store. Increase
amount of execution attempts to 11 (10 retries) so that total time
spent in retries is 17.05min.

Closes #548

Introduce exponential back-off mechanism for waiting between retries
when TransportErrors occurs towards the metrics store.  Increase
amount of execution attempts to 11 (10 retries) so that total time
spent in retries is 17.05min.
@dliappis dliappis added enhancement Improves the status quo :Metrics How metrics are stored, calculated or aggregated labels Aug 10, 2018
@dliappis dliappis added this to the 1.0.1 milestone Aug 10, 2018
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I left one comment around the usage of random.randint.

execution_count = 0

while execution_count < max_execution_count:
time_to_sleep = 2 ** execution_count + (random.randint(0, 1000) / 1000)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason you use random.randint(0, 1000) / 1000 instead of just random.random()?

Copy link
Member

Choose a reason for hiding this comment

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

Might also be worth adding a debug log statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh was thinking too much in milliseconds.

@dliappis dliappis merged commit d285248 into elastic:master Aug 13, 2018
@dliappis dliappis deleted the exponential-backoff-for-metrics-store-retries branch August 13, 2018 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :Metrics How metrics are stored, calculated or aggregated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants