app/vlagent: move backoff timer logic to a separate package#1194
Open
vadimalekseev wants to merge 1 commit intomasterfrom
Open
app/vlagent: move backoff timer logic to a separate package#1194vadimalekseev wants to merge 1 commit intomasterfrom
vadimalekseev wants to merge 1 commit intomasterfrom
Conversation
vadimalekseev commented Mar 18, 2026
| select { | ||
| case <-c.stopCh: | ||
| timerpool.Put(t) | ||
| remoteWriteRetryLogger.Warnf("couldn't send a block with size %d bytes to %q: %s; re-sending the block in %s", |
Member Author
There was a problem hiding this comment.
%.3f was replaced with %s because backoffTimer returns multiples of minInterval without jitter. For example: 100ms, 200ms, 400ms, 800ms, 1.6s, etc.
vadimalekseev commented Mar 18, 2026
| | ||
| defer func() { | ||
| v := retryAfterDuration.Seconds() | ||
| logger.Infof("'Retry-After: %s' parsed into %.2f second(s)", retryAfterString, v) |
Member Author
There was a problem hiding this comment.
Can someone confirm or deny if this log was added by accident?
e9d2cd8 to 711586a Compare vadimalekseev commented Mar 18, 2026
| ) | ||
| | ||
| // BackoffTimer implements an exponential backoff timer with jitter. | ||
| type BackoffTimer struct { |
Member Author
There was a problem hiding this comment.
I think it would be useful to add a noCopy struct here to prevent accidental copying of the BackoffTimer. See this issue for details:
golang/go#8005 (comment)
2 tasks
This file contains hidden or 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
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.
Describe Your Changes
I'm working on moving the file-reading logic into a separate package. This change is needed to support not only Kubernetes Pods but also reading from arbitrary files via glob patterns and reading Docker containers. See #1195 for details.
During the migration, I noticed that the
backoffTimerstruct is being used across several different packages. It could also be utilized in theremotewritepackage (see the usage example in this PR). The same approach can be applied to these locations in the VictoriaMetrics repository:I believe this logic should be moved to the
timeutilpackage within the VictoriaMetrics repository.Checklist
The following checks are mandatory: