Skip to content

fix(logql): Wrap count min sketch errors with operator name - #24157

Open
hundredwatt wants to merge 3 commits into
mainfrom
fix/approx-topk-instant-error
Open

fix(logql): Wrap count min sketch errors with operator name#24157
hundredwatt wants to merge 3 commits into
mainfrom
fix/approx-topk-instant-error

Conversation

@hundredwatt

@hundredwatt hundredwatt commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Range queries that use a count-min sketch operator now fail with <operator> error: count min sketches are only supported on instant queries.
  • The sketch eval node records the user-facing operator that produced it (today approx_topk), so a future CMS-backed function can reuse the same path.

Test plan

  • go test -count=1 -timeout 5m -run 'TestLogQLScripts/functions.logqltest' ./pkg/logql/internal/logqltest/
  • go test -count=1 -timeout 3m -run 'TestErrCountMinSketchInstantOnly|TestHeapCountMinSketch|TestCountMinSketch|TestMapping|TestApproxTopk' ./pkg/logql/
  • In Grafana Explore, run a range approx_topk(...) query and confirm the error starts with approx_topk error:.

Risks

None. Error text and operator metadata only; query behavior is unchanged.

Range queries were rejected with "count min sketches", an implementation
detail users do not see in the operator they wrote.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hundredwatt
hundredwatt requested a review from a team as a code owner August 22, 2026 12:16
hundredwatt and others added 2 commits August 22, 2026 06:23
Range-query errors now name whichever operator produced the sketch, so a
future CMS-backed function does not inherit a hardcoded approx_topk message.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the original count-min-sketch wording and add the user-facing
operator name, instead of walking the AST to replace the message.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hundredwatt hundredwatt changed the title fix(logql): Name approx_topk in instant-query errors fix(logql): Wrap count min sketch errors with operator name Aug 22, 2026
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.

1 participant