Skip to content

Ingester: Metadata APIs should honour QueryIngestersWithin when QueryStoreForLabels is enabled #5027

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

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

harry671003
Copy link
Contributor

What this PR does:
Before adding the feature to query

Ingesters will keep the blocks on disk for up-to: -blocks-storage.tsdb.retention-period. This can be a lot more than the QueryIngestersWithin duration. The query path is already optimized to only query the blocks falling within now() - QueryIngestersWithin from ingesters. This PR adds the optimization also for the metadata APIs.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the changelog changes. Thanks for the awesome work!

@harry671003 harry671003 force-pushed the ingester_querying branch 2 times, most recently from 5d1ab32 to 1737e53 Compare December 8, 2022 19:09
// older time ranges (while in Cortex we do ignore the start/end and always return
// series in ingesters).
// Also, in the recent versions of Prometheus, we pass in the hint but with Func set to "series".
if q.queryIngestersWithin > 0 && !(sp != nil && sp.Func == "series" && !q.queryStoreForLabels) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is this condition too hard to read?
Maybe we could do something like:

// We should query store if `queryStoreForLabels` it set OR we need the chunks
shouldQueryStore := q.queryStoreForLabels || (sp != nil && sp.Func != "series")
if shouldQueryStore && queryIngestersWithin {
      // Do the time manipulation
}

@alanprot
Copy link
Member

alanprot commented Dec 9, 2022

Should we enable query store by default? We may even consider deprecate this flag (and enable always) so we stop doing all these if conditions

@harry671003
Copy link
Contributor Author

Should we enable query store by default? We may even consider deprecate this flag (and enable always) so we stop doing all these if conditions

@alanprot - I can mark the flag as deprecated. Until we remove this flag, we need to do this checks in both ingesters and queriers so that the default behaviour (of querying all the blocks on ingesters) remains the same. Lmk, if I should deprecate this flag in this PR.

@alanprot alanprot merged commit bdf043f into cortexproject:master Dec 14, 2022
alexqyle pushed a commit to alexqyle/cortex that referenced this pull request May 2, 2023
…StoreForLabels is enabled (cortexproject#5027)

* Ingester Metadata APIs should honour QueryIngestersWithin

Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>

* Deprecate query-store-for-labels-enabled flag

Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>

Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
Signed-off-by: Alex Le <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants