-
Notifications
You must be signed in to change notification settings - Fork 797
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
Query Sample Statistics #4708
Query Sample Statistics #4708
Conversation
result.Samples.TotalQueryableSamples += output[key].Value | ||
} | ||
|
||
if !hasStats { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move this check right after the above for
loop right?
@@ -380,6 +395,46 @@ func (s *SampleStream) MarshalJSON() ([]byte, error) { | |||
return json.Marshal(stream) | |||
} | |||
|
|||
// statsMerge merge the stats from 2 responses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can merge more than 2 responses right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}, | ||
}, | ||
{ | ||
name: "[stats] Merging of samples where there is complete overlap.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be good idea to add some test cases to show the merge function works with more than 2 series.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/querier/querier.go
Outdated
@@ -92,6 +93,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) { | |||
f.DurationVar(&cfg.QueryIngestersWithin, "querier.query-ingesters-within", 0, "Maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.") | |||
f.BoolVar(&cfg.QueryStoreForLabels, "querier.query-store-for-labels-enabled", false, "Query long-term store for series, label values and label names APIs. Works only with blocks engine.") | |||
f.BoolVar(&cfg.AtModifierEnabled, "querier.at-modifier-enabled", false, "Enable the @ modifier in PromQL.") | |||
f.BoolVar(&cfg.EnablePerStepStats, "querier.per-step-stats-enabled", false, "Enable returning samples stats per steps in PromQL.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of the flag is a bit weird, the stats is not returned in PromQL, but PromQL response. Or maybe just "query response".
* Implementing stats on results_cache * Fix TestResultsCacheRecent * adding some comments * Update Changelog * Add test case with 3 responses * address feedback * Doc update Signed-off-by: Yijie Qin <[email protected]>
Signed-off-by: Friedrich Gonzalez <[email protected]>
This PR brings the functionality implemented on prometheus/prometheus#10369 to cortex.
In order to do so, cortex now cache the per step statistics on the results cache and
extract/merge
to fulfill the request.What this PR does:
-querier.per-step-stats-enabled
to enable prometheusPerStepStats
-frontend.cache-queryable-samples-stats
to cache the samples stats on the results cacheWhich issue(s) this PR fixes:
Bring prometheus feature implemented prometheus/prometheus#10369 to cortex.
Fixes partially: #4630
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]