Skip to content

[Enhancement] heavy query weights#5782

Merged
ruslan-mikhailov merged 5 commits intografana:mainfrom
ruslan-mikhailov:enhancement/heavy-query-weights
Oct 28, 2025
Merged

[Enhancement] heavy query weights#5782
ruslan-mikhailov merged 5 commits intografana:mainfrom
ruslan-mikhailov:enhancement/heavy-query-weights

Conversation

@ruslan-mikhailov
Copy link
Copy Markdown
Contributor

@ruslan-mikhailov ruslan-mikhailov commented Oct 22, 2025

What this PR does: It adds three more conditions when to add +1 to weight:

  1. If AllConditions is false
  2. Full trace is needed
  3. SecondPassSelectAll is true

Which issue(s) this PR fixes:
Fixes #

Checklist

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

{
// Aggregate requiring full trace
query: "{} | count() > 5",
expected: TraceQLSearchWeight + 2, // +1 for AllConditions is false, +1 for NeedsFullTrace
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be sure I understand well what part of the code added weight, I modified it to "weight += 10, 100, 1000` and so on (different on each line), run the test and double-checked comments.

Comment thread modules/frontend/pipeline/async_weight_middleware.go
Copy link
Copy Markdown
Contributor

@javiermolinar javiermolinar left a comment

Choose a reason for hiding this comment

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

Code looks good but we need to ensure no contention is happening now. We should also check if we need to bump the MaxBatchSize which is currently 7 by default

@ruslan-mikhailov ruslan-mikhailov force-pushed the enhancement/heavy-query-weights branch from c538054 to aa1a033 Compare October 24, 2025 11:36
@ruslan-mikhailov
Copy link
Copy Markdown
Contributor Author

+ rebase from main to resolve conflicts in Changelog

@ruslan-mikhailov
Copy link
Copy Markdown
Contributor Author

I ran internal e2e load tests, no degradation noticed

@ruslan-mikhailov ruslan-mikhailov merged commit 7f5c1e6 into grafana:main Oct 28, 2025
22 checks passed
@ruslan-mikhailov ruslan-mikhailov deleted the enhancement/heavy-query-weights branch October 28, 2025 10:31
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.

3 participants