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

Include route name in query stats log lines emitted by query-frontends #8191

Merged
merged 2 commits into from
May 28, 2024

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented May 28, 2024

What this PR does

This PR builds on grafana/dskit#527 to add the route name to query stats log lines emitted by query-frontends.

This is useful when searching or analysing these log lines, particularly for APIs where the URL varies based on the request (eg. the label values API, where the URL is /prometheus/api/v1/label/{name}/values).

For example (notice the route_name value):

ts=2024-05-28T06:56:25.614545465Z caller=handler.go:374 level=info user=anonymous traceID=0c6048d9d2833e7a msg="query stats" component=query-frontend method=GET path=/prometheus/api/v1/query route_name=prometheus_api_v1_query user_agent=Grafana/10.1.5 status_code=200 response_time=4.493ms response_size_bytes=4139 query_wall_time_seconds=0.003131375 fetched_series_count=15 fetched_chunk_bytes=1429 fetched_chunks_count=30 fetched_index_bytes=0 sharded_queries=0 split_queries=0 estimated_series_count=0 queue_time_seconds=3.35e-05 param_query=up param_time=2024-05-28T06:56:25.577Z length=5m0s time_since_min_time=5m0.032958715s time_since_max_time=32.958715ms results_cache_hit_bytes=0 results_cache_miss_bytes=0 status=success

The values of route_name match those used in metrics and traces emitted by the query-frontend.

Which issue(s) this PR fixes or relates to

(none)

Checklist

  • Tests updated.
  • [n/a] Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn marked this pull request as ready for review May 28, 2024 07:03
@charleskorn charleskorn requested a review from a team as a code owner May 28, 2024 07:03
@charleskorn charleskorn merged commit dc2aedb into main May 28, 2024
29 checks passed
@charleskorn charleskorn deleted the charleskorn/include-route-in-query-stats-logs branch May 28, 2024 08:21
narqo pushed a commit to narqo/grafana-mimir that referenced this pull request Jun 6, 2024
grafana#8191)

* Include route name in query stats log lines emitted by query-frontends

* Add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants