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

Improve the frontend slow query logs. #2520

Merged
merged 5 commits into from
Apr 24, 2020

Conversation

cyriltovena
Copy link
Contributor

This will help for the log to be more readable, parsable. I've also added the traceID using the context logger.

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

@cyriltovena
Copy link
Contributor Author

Need rebase on #2521

This will help for the log to be more readable, parsable.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM! I've also rebased master.

"time_taken", queryResponseTime.String(),
}
for k, v := range r.URL.Query() {
append(logMessage, fmt.Sprintf("qs_%s", k), strings.Join(v, ","))
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a bug here. logMessage is not updated with the result of append(). I fix it for you.

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci
Copy link
Contributor

For other reviewers, this is an example log:

level=info ts=2020-04-24T05:41:30.1960564Z caller=frontend.go:177 org_id=fake trace_id=565b3488fe9aa3a6 msg="slow query" host=host.docker.internal:8007 path=/api/prom/api/v1/query_range time_taken=10.1883ms qs_start=1587703290 qs_end=1587706890 qs_step=15 qs_query="up "

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

LGTM, with a nit.

pkg/querier/frontend/frontend.go Outdated Show resolved Hide resolved
@pracucci pracucci merged commit 06c4920 into cortexproject:master Apr 24, 2020
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