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

Calculate instant query count() without fetching samples #143

Open
GiedriusS opened this issue Jan 5, 2023 · 1 comment
Open

Calculate instant query count() without fetching samples #143

GiedriusS opened this issue Jan 5, 2023 · 1 comment
Labels
optimization PromQL optimization work

Comments

@GiedriusS
Copy link
Member

GiedriusS commented Jan 5, 2023

See: prometheus/prometheus#10073

If it's an instant query then we can calculate count() without fetching any samples with some caveats:

Now I think about it some more, I'm not sure we can get the same result without samples.
I think in the current code it will look back the stale time (5 minutes), and if there is no sample then the series will not appear.
Whereas the alternative code path will return every series in the head, typically anything that had a sample in the last 2-3 hours.

So while I still want the cheaper implementation, we would need to address backwards-compatibility.
@GiedriusS GiedriusS added the optimization PromQL optimization work label Jan 5, 2023
@GiedriusS
Copy link
Member Author

Hmm, I wonder how it would work if we called /api/v1/series with the respective matchers and start/end set to the same timestamp. Does it mean that the /api/v1/series is broken if it returns series even outside the requested timestamp i.e. series that is in the head but does not necessarily exist during the given time instant? 😄 need to double-check

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

No branches or pull requests

1 participant