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

Query-frontend: add traceID to slow query detected log line #6148

Merged
merged 6 commits into from Feb 21, 2023
Merged

Query-frontend: add traceID to slow query detected log line #6148

merged 6 commits into from Feb 21, 2023

Conversation

abaguas
Copy link
Contributor

@abaguas abaguas commented Feb 21, 2023

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Add traceID to slow query detected log line. The traceID is extracted from the X-Thanos-Trace-Id header, which is send in the request.
If there is no trace id the value will be empty. This behaviour is similar to the already existing log fields grafana_dashboard_uid and grafana_panel_id.

This will greatly facilitate debugging as we are often interested in analyzing the traces of the slowest queries

Verification

Built the binary, deployed it as query frontend and checked its logs:

level=info ts=2023-02-21T11:15:28.920622293Z caller=handler.go:194 org_id=anonymous msg="slow query detected" method=POST host=thanos-query-frontend-grafana.thanos.svc:9090 path=/api/v1/query time_taken=192.624733ms grafana_dashboard_uid=- grafana_panel_id=- trace_id=c33ad57d9ed443895223d5fa01499ead param_query="avg(kube_persistentvolume_capacity_bytes) by (cluster_id, persistentvolume)[1h:1m]" param_time=1676980800

Signed-off-by: Andre Baptista Aguas <andre.aguas@protonmail.com>
@abaguas abaguas changed the title Include traceID in slow query detected log line Query-frontend: Include traceID in slow query detected log line Feb 21, 2023
@abaguas abaguas changed the title Query-frontend: Include traceID in slow query detected log line Query-frontend: add traceID to slow query detected log line Feb 21, 2023
abaguas and others added 3 commits February 21, 2023 13:50
Signed-off-by: Andre Baptista Aguas <andre.aguas@protonmail.com>
Signed-off-by: André Águas <abaguas@users.noreply.github.com>
Signed-off-by: André Águas <abaguas@users.noreply.github.com>
fpetkovski
fpetkovski previously approved these changes Feb 21, 2023
Copy link
Contributor

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

Love it, just one small nit!

CHANGELOG.md Show resolved Hide resolved
Signed-off-by: Andre Baptista Aguas <andre.aguas@protonmail.com>
Copy link
Contributor

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

LGTM!

@fpetkovski fpetkovski merged commit 36ce9cb into thanos-io:main Feb 21, 2023
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.

None yet

3 participants