-
Notifications
You must be signed in to change notification settings - Fork 812
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
Add -frontend.enabled-ruler-query-stats flag #6504
base: master
Are you sure you want to change the base?
Add -frontend.enabled-ruler-query-stats flag #6504
Conversation
3665b72
to
62d1df3
Compare
62d1df3
to
0ad89c4
Compare
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.
However, the user would want to report the log only from other sources since its main role is to export API endpoints for other sources.
Idk if I agree that QFE wants to mainly log requests from API endpoints. Why we don't always log all requests?
pkg/frontend/transport/handler.go
Outdated
} else { | ||
level.Info(util_log.WithContext(r.Context(), f.log)).Log(logMessage...) | ||
} | ||
} |
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.
There are some duplicate code. Can we just do if else
?
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 was thinking we can just do
shouldLog := source == tripperware.SourceAPI || (f.cfg.EnabledRulerQueryStatsLog && source == tripperware.SourceRuler)
if shouldLog {
...
}
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.
Thanks, I also like it. I just updated the PR.
pkg/frontend/transport/handler.go
Outdated
LogQueriesLongerThan time.Duration `yaml:"log_queries_longer_than"` | ||
MaxBodySize int64 `yaml:"max_body_size"` | ||
QueryStatsEnabled bool `yaml:"query_stats_enabled"` | ||
EnabledRulerQueryStatsLog bool `yaml:"enabled_ruler_query_stats-log"` |
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.
Should we name it enabled_ruler_query_stats_log
?
pkg/frontend/transport/handler.go
Outdated
if f.cfg.EnabledRulerQueryStatsLog { | ||
logMessage = append(logMessage, formatQueryString(queryString)...) | ||
level.Info(util_log.WithContext(r.Context(), f.log)).Log(logMessage...) | ||
} |
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.
ditto
@yeya24 Since the Ruler leaves the rule evaluation log, the |
I see. I wonder if we want to make it more extensible or it is too much. Should we accept a list of wildcards of user agent to log or not log? |
@yeya24 |
0ad89c4
to
c3dc48c
Compare
c3dc48c
to
e9c8cfb
Compare
25a9850
to
345dc85
Compare
Hello @SungJin1212, thank you for opening this PR. There is a release in progress. As such, please rebase your CHANGELOG entry on top of the master branch and move the CHANGELOG entry to the top under Thanks, |
Signed-off-by: SungJin1212 <[email protected]>
345dc85
to
2196382
Compare
@CharlieTLe |
This PR adds a
-frontend.enabled-ruler-query-stats
flag to configure whether to report the query stats log for queries coming from the Ruler.Context & Use case
When the
-ruler.frontend-address
and-frontend.enabled-ruler-query-stats
are enabled, the query-frontend reports the query stats log for queries from the Ruler and other sources. However, the user would want to report the log only from other sources since its main role is to export API endpoints for other sources.To address this concern, this PR adds
-frontend.enabled-ruler-query-stats
to report queries only from the other sources.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]