-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add exponential backoff and jitter for retries #204
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1d4284d
to
ccfdd0a
Compare
nehaev
reviewed
Jan 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @acm19!
Overall the PR looks good. However, comments need to be addressed.
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
loki-logback-appender/src/test/java/com/github/loki4j/logback/Loki4jAppenderTest.java
Outdated
Show resolved
Hide resolved
loki-logback-appender/src/test/java/com/github/loki4j/logback/Loki4jAppenderTest.java
Outdated
Show resolved
Hide resolved
loki-logback-appender/src/test/java/com/github/loki4j/logback/Loki4jAppenderTest.java
Outdated
Show resolved
Hide resolved
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
382544d
to
ddd8577
Compare
nehaev
reviewed
Jan 20, 2024
loki-logback-appender/src/main/java/com/github/loki4j/logback/Loki4jAppender.java
Outdated
Show resolved
Hide resolved
nehaev
reviewed
Jan 20, 2024
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
e2bb1ad
to
5ea1179
Compare
99e26e4
to
783308b
Compare
ee2f708
to
e721420
Compare
nehaev
reviewed
Feb 5, 2024
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
nehaev
reviewed
Feb 5, 2024
loki-client/src/main/java/com/github/loki4j/client/pipeline/Jitter.java
Outdated
Show resolved
Hide resolved
nehaev
reviewed
Feb 5, 2024
loki-client/src/main/java/com/github/loki4j/client/pipeline/PipelineConfig.java
Outdated
Show resolved
Hide resolved
Adds exponential backoff by multiplying the `retryTimeoutMs` by `2^attempt`. Adds a random jitter to spread out the retries. Although in the initial implementation the retry function isn't available to the user the code is written in a way that makes it easier to change that. Refactors the tests to avoid using `Thread#sleep`, which is not only a bad practice producing not deterministic tests but also makes them very slow. A reduction of more that 90% of testing time is percieved for the tests where this was changed. Resolves: loki4j#194
Looks good! Thank you @acm19! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds exponential backoff by multiplying the
retryTimeoutMs
by2^attempt
. Adds a random jitter to spread out the retries. Although in the initial implementation the retry function isn't available to the user the code is written in a way that makes it easier to change that.Refactors the tests to avoid using
Thread#sleep
, which is not only a bad practice producing not deterministic tests but also makes them very slow. A reduction of more that 90% of testing time is percieved for the tests where this was changed.Resolves: #194