Advanced Query Processing Architecture - #7
Open
ShashankFC wants to merge 1 commit into
Open
Conversation
…7534) * Loki query splitting: interpolate queries before execution * Update tests * Prettier * shardQuerySplitting: remove unnecessary call
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors template variable interpolation in Loki query processing to apply variables on a per-query basis rather than in bulk. The change ensures that template variables like $__auto and $step are properly substituted before query execution in both shard-based and time-based query splitting paths.
Changes:
- Replaced bulk
interpolateVariablesInQueries()calls with per-queryapplyTemplateVariables()mapping - Updated test mocks to reflect the new per-query interpolation approach
- Added new test cases to verify template variable interpolation before query execution
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| public/app/plugins/datasource/loki/shardQuerySplitting.ts | Refactored to apply template variables per-query using map() instead of bulk interpolation |
| public/app/plugins/datasource/loki/shardQuerySplitting.test.ts | Updated mocks from bulk to per-query interpolation and added test for variable substitution |
| public/app/plugins/datasource/loki/querySplitting.ts | Applied same per-query template variable interpolation pattern |
| public/app/plugins/datasource/loki/querySplitting.test.ts | Added test case to verify template variables are interpolated before execution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test 4nn
Summary by CodeRabbit
Bug Fixes
$__autoand time intervals are now properly substituted before query execution on a per-query basis, ensuring accurate query processing and results.Tests
✏️ Tip: You can customize this high-level summary in your review settings.
nn---n*Replicated from [ai-code-review-evaluation/grafana-coderabbit#4](https://github.com/ai-code-review-evaluation/grafana-coderabbit/pull/4)*