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

[k189] feat(metadata): introduce a separate split interval for recent query window #11942

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

grafanabot
Copy link
Collaborator

Backport 9e7725b from #11897


What this PR does / why we need it:

Metadata queries are split using a 24h interval by default. The same interval gets used in the cache key.
But it is not possible to extract a subset of labels/series from a cached extent, unlike samples they are not associated with a timestamp. To prevent short queries from returning the results of an entire 24h extent, caching is disabled for the last 24h by default using max_metadata_cache_freshness.

But we have noticed in our cloud environments that most queries fall in the last 24h interval. This pr introduces the following changes to help cache the recent metadata query results:

  • Use a smaller split interval for caching recent metadata queries. Portion of the query within recent_metadata_query_window is split using a different interval of split_recent_metadata_queries_by_interval.
  • Only use extents that are entirely within the requested metadata query range. This is done to avoid using extents that contain results from the outside of the requested range.

To use a shorter split interval for recent metadata queries, the following needs to be configured:

  • recent_metadata_query_window to configure the window inside which the shorter split interval gets applied. Disabled by default.
  • split_recent_metadata_queries_by_interval to configure the split interval for the portion of the query within the recent metadata query window. Defaults to 1h. Recommended to be configured to a value smaller than split_metadata_queries_by_interval.
  • reduce max_metadata_cache_freshness to control the cache freshness

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
    • If the change is worth mentioning in the release notes, add add-to-release-notes label
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@grafanabot grafanabot requested a review from a team as a code owner February 14, 2024 11:18
@grafanabot grafanabot added backport size/XXL type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories labels Feb 14, 2024
@ashwanthgoli ashwanthgoli merged commit 0fa1425 into k189 Feb 14, 2024
13 of 14 checks passed
@ashwanthgoli ashwanthgoli deleted the backport-11897-to-k189 branch February 14, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport size/XXL type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants