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

allow 0 as a valid truncation timestamp #440

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ can be found at [#317](https://github.com/grafana/agent/issues/317).
- [BUGFIX] Native Darwin arm64 builds will no longer crash when writing metrics
to the WAL. (@rfratto)

- [BUGFIX] Remote write endpoints that never function across the lifetime of the
Agent will no longer prevent the WAL from being truncated. (@rfratto)

# v0.13.0 (2021-02-25)

The primary branch name has changed from `master` to `main`. You may have to
Expand Down
8 changes: 3 additions & 5 deletions pkg/prom/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,10 @@ func (i *Instance) truncateLoop(ctx context.Context, wal walStorage, cfg *Config
//
// Subtracting a duration from ts will delay when it will be considered
// inactive and scheduled for deletion.
ts := i.getRemoteWriteTimestamp()
if ts == 0 {
level.Debug(i.logger).Log("msg", "can't truncate the WAL yet")
continue
ts := i.getRemoteWriteTimestamp() - i.cfg.MinWALTime.Milliseconds()
if ts < 0 {
ts = 0
}
Copy link
Member Author

Choose a reason for hiding this comment

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

0 is a perfectly valid timestamp and there was no reason to do this 🤷

ts -= i.cfg.MinWALTime.Milliseconds()

// Network issues can prevent the result of getRemoteWriteTimestamp from
// changing. We don't want data in the WAL to grow forever, so we set a cap
Expand Down