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

tsdb: Add MustIndex() function to Head #811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ying-jeanne
Copy link
Contributor

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.

Comment on lines +40 to +43
func (h *Head) MustIndex() IndexReader {
return h.indexRange(math.MinInt64, math.MaxInt64)
}

Copy link
Contributor

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.

Comment on lines +431 to +433

irMust := h.MustIndex()
require.Equal(t, irMust, ir)
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants