-
Notifications
You must be signed in to change notification settings - Fork 10
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
tsdb: Add MustIndex() function to Head #811
Conversation
tsdb/head_read.go
Outdated
func (h *Head) MustIndex() IndexReader { | ||
return h.indexRange(math.MinInt64, math.MaxInt64) | ||
} | ||
|
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.
Nit, we don't have a policy on this yet, but can you create a new file, called head_read_mimir.go
and put this method there? This way we'll avoid a bunch of confclicting updates with upstream in the future.
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.
addressed in 7a70886
tsdb/head_read_test.go
Outdated
|
||
irMust := h.MustIndex() | ||
require.Equal(t, irMust, ir) |
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.
This should go in a separate test (also as noted above, in a separate file)
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.
addressed in 7a70886
CHANGELOG.md
Outdated
@@ -4,6 +4,7 @@ | |||
|
|||
* [CHANGE] Notifier: Increment the prometheus_notifications_errors_total metric by the number of affected alerts rather than by one per batch of affected alerts. #15428 | |||
* [ENHANCEMENT] OTLP receiver: Convert also metric metadata. #15416 | |||
* [ENHANCEMENT] Introduced MustIndex() as a variant of Index() in tsdb Head that does not return an error. #811 |
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.
We don't update the changelog in mimir-prometheus
, please remove this, otherwise it will be just a source of merge conflicts in the future.
Approved modulo the changelog nit, please address it before merging. |
In the context of cost attribution in this PR #10269, I need to retrieve the index to decrement the active series count when a series goes out of the 20-minute active series window. Since the current Index() function does not return an error, we propose introducing a new function, MustIndex(), which will never return an error. Additionally, I will add tests to ensure that both functions return the same results.