split series api queries by day in query-frontend #3530
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Series APIs are one of the most expensive queries in Loki which is used by Grafana Explore to suggest relevant labels to the users while building logql query. It is quite easy to run those queries accidentally for longer durations when the selected time window is a week or even a month-long and a user tries to write a query.
The problem here is we split the series API queries the same as other queries and we split the queries by smaller intervals like 15 or 30 minutes to get max parallelism. Now the series API downloads a single chunk per series in each split query which means the smaller the split interval more the work for queries since they would download chunks for the same series over and over again for each split queries. This PR changes the code to split the series API queries by 24h which also aligns with our daily buckets and reaps the same benefits as labels API splitting.