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

Fix reset handling by checking against previous value instead of reset value. #263

Merged
merged 4 commits into from
Jan 12, 2021
Merged
Changes from 1 commit
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
14 changes: 11 additions & 3 deletions retrieval/series_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,21 @@ type seriesCacheEntry struct {
suffix string
hash uint64

// Whether the series has been reset/initialized yet. This is false only for
// the first sample of a new series in the cache, which causes the initial
// "reset". After that, it is always true.
hasReset bool

// The value and timestamp of the latest reset. The timestamp is when it
// occurred and the value is what it was reset to. resetValue will initially
Copy link
Member

Choose a reason for hiding this comment

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

Grammar nit: need a comma before the "and".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

// be the value of the first sample, and then 0 for every subsequent reset.
resetValue float64
resetTimestamp int64

// Value of the most recent point seen for the time series. If a new value is
// less than the previous, then the series has reset.
previousValue float64

hasReset bool
resetValue float64
resetTimestamp int64
// maxSegment indicates the maximum WAL segment index in which
// the series was first logged.
// By providing it as an upper bound, we can safely delete a series entry
Expand Down