Skip to content

Advanced Query Processing Architecture - #7

Open
ShashankFC wants to merge 1 commit into
query-splitting-baselinefrom
query-splitting-enhancements
Open

Advanced Query Processing Architecture#7
ShashankFC wants to merge 1 commit into
query-splitting-baselinefrom
query-splitting-enhancements

Conversation

@ShashankFC

Copy link
Copy Markdown

Test 4nn

Summary by CodeRabbit

  • Bug Fixes

    • Fixed template variable interpolation in Loki queries. Variables such as $__auto and time intervals are now properly substituted before query execution on a per-query basis, ensuring accurate query processing and results.
  • Tests

    • Added and updated test coverage to verify template variable interpolation occurs correctly before query execution.

✏️ 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)*

…7534)

* Loki query splitting: interpolate queries before execution

* Update tests

* Prettier

* shardQuerySplitting: remove unnecessary call
@ShashankFC
ShashankFC requested a review from Copilot January 30, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-query applyTemplateVariables() 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.

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