-
Notifications
You must be signed in to change notification settings - Fork 451
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-frontend: add experimental header for tracking throughput #7966
base: main
Are you sure you want to change the base?
Conversation
pkg/frontend/transport/handler.go
Outdated
@@ -62,6 +64,7 @@ func (cfg *HandlerConfig) RegisterFlags(f *flag.FlagSet) { | |||
f.Var(&cfg.LogQueryRequestHeaders, "query-frontend.log-query-request-headers", "Comma-separated list of request header names to include in query logs. Applies to both query stats and slow queries logs.") | |||
f.Int64Var(&cfg.MaxBodySize, "query-frontend.max-body-size", 10*1024*1024, "Max body size for downstream prometheus.") | |||
f.BoolVar(&cfg.QueryStatsEnabled, "query-frontend.query-stats-enabled", true, "False to disable query statistics tracking. When enabled, a message with some statistics is logged for every query.") | |||
f.BoolVar(&cfg.ExtraQueryStatsHeaders, "query-frontend.extra-stats-headers", false, "Add extra query stats headers to the response.") |
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.
is there a drawback to always returning the header?
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.
hmm, not really, but this is super experimental, don't want people to depend on it
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.
Same comment as Dimitar. You can just document it as experimental in about-version
and we're good.
pkg/frontend/transport/handler.go
Outdated
@@ -448,6 +454,12 @@ func writeServiceTimingHeader(queryResponseTime time.Duration, headers http.Head | |||
} | |||
} | |||
|
|||
func writeStatsHeader(headers http.Header, stats *querier_stats.Stats) { | |||
if stats != nil { | |||
headers.Set(MimirQueryStatsHeaderName, fmt.Sprintf("fetched_chunk_bytes=%d", stats.GetFetchedChunkBytes())) |
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 stats are modified using atomics - so they should be read with:
mimir/pkg/querier/stats/stats.go
Line 86 in e238310
func (s *Stats) LoadFetchedChunkBytes() uint64 { |
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
83f4820
to
f216056
Compare
Rebased and removed the flag. Next: change to track samples loaded. |
We'll use this instead of chunks bytes as it is simpler for the enduser to understand. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
75e398b
to
186306e
Compare
defaultStatsRenderer->DefaultStatsRenderer Add short docstrings. I'd like to use the stats renderer to peek at the statistics in grafana/mimir#7966 However I cannot call the original function without this export afterwards. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
defaultStatsRenderer->DefaultStatsRenderer Add short docstrings. I'd like to use the stats renderer to peek at the statistics in grafana/mimir#7966 However I cannot call the original function without this export afterwards. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
What this PR does
Add an experimental configuration parameter
-query-frontend.extra-stats-headers
to be able to send fetched chunk bytes to the gateway for measuring throughput.Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.