Skip to content

Conversation

mdisibio
Copy link
Contributor

@mdisibio mdisibio commented Dec 2, 2024

What this PR does:
Fixes issues with using unscoped attributes in metrics queries: #3806 (comment)

The summary is that metrics queries do a lot of work to optimize away the engine callback, relying solely on storage predicate pushdowns. Unscoped queries like { .foo && .bar } were optimizing it away when they shouldn't.

Unfortunately still thinking about the best fix for { false } | rate(). To the storage layer it looks identical to { true } | rate().

Finally introduces some high-level metrics queries tests by writing test blocks with known frequencies of spans and querying them.

Which issue(s) this PR fixes:
Fixes #3806

Checklist

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

@mdisibio
Copy link
Contributor Author

mdisibio commented Dec 2, 2024

Pushed a possible fix for { false } | rate() in the query frontend. This is the ideal behavior in that it doesn't execute any jobs or read any blocks. But it's hard to confidently say it works for all variations on falsey queries.

Copy link
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

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

LGTM

@mdisibio mdisibio marked this pull request as ready for review December 3, 2024 12:21
@mdisibio mdisibio merged commit b9321f4 into grafana:main Dec 4, 2024
16 checks passed
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.

TraceQL Metrics: { false } | rate() returns data
2 participants