cortex icon indicating copy to clipboard operation
cortex copied to clipboard

Add rule information to query paramters sent to the QFE

Open SungJin1212 opened this issue 11 months ago • 6 comments

When the -ruler.frontend-address is configured, the Ruler evaluates rules via QFE. But, all of the values of the query stats logs and metrics in the Ruler are 0 because the QFE doesn't send query stat.

In Ruler, for example: the query stats logs are:

cortex_ruler_query_seconds_total=0.003627083 query_wall_time_seconds=0s query_storage_wall_time_seconds=0s fetched_series_count=0 fetched_chunks_count=0 fetched_samples_count=0 fetched_chunks_bytes=0 fetched_data_bytes=0

Also, the values of these metrics are all 0

cortex_ruler_fetched_series_total, cortex_ruler_samples_total, cortex_ruler_fetched_chunks_bytes_total ...

To address it, this PR adds rule information to query parameters sent to the QFE to leave rule information logs on query stats. For the metric, #6470 add the source label to categorize query stat metric.

Which issue(s) this PR fixes: Fixes #

Checklist

  • [ ] Tests updated
  • [ ] Documentation added
  • [x] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

SungJin1212 avatar Jan 23 '25 06:01 SungJin1212

Maybe we can return the stats at least on the proto response?

alanprot avatar Jan 28 '25 04:01 alanprot

@alanprot Yeah, we could return query stats in the protobuf from QFE to Ruler. But Idk if it is worth it more. We can leave query stats logs by adding query parameters at the Ruler. (https://github.com/cortexproject/cortex/blob/master/pkg/frontend/transport/handler.go#L514)

SungJin1212 avatar Jan 28 '25 06:01 SungJin1212

But the rulers logs would still be "empty" right? so should we at least stop logging it?

alanprot avatar Jan 30 '25 19:01 alanprot

But the rulers logs would still be "empty" right? so should we at least stop logging it?

Yeah, the evaluation logs are still empty. Stopping the logging at the Ruler is fine for me. @yeya24 WDYT?

SungJin1212 avatar Jan 31 '25 01:01 SungJin1212

@yeya24 I changed the behavior, the Ruler tracks metrics and logs only if -ruler.frontend-address is not configured. When -ruler.frontend-address flag is set, the QFE tracks logs and metrics.

SungJin1212 avatar Feb 19 '25 05:02 SungJin1212

This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 19 '25 06:07 stale[bot]