-
Notifications
You must be signed in to change notification settings - Fork 9
Advanced Query Processing Architecture #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: query-splitting-baseline
Are you sure you want to change the base?
Conversation
…7534) * Loki query splitting: interpolate queries before execution * Update tests * Prettier * shardQuerySplitting: remove unnecessary call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR refactors the template variable interpolation architecture in the Loki datasource's query splitting functionality. The changes standardize how template variables (like $__interval, $__auto, $step, and user-defined variables) are processed across different query splitting paths.
The key architectural change replaces the interpolateVariablesInQueries() method with the standard Grafana datasource pattern of using applyTemplateVariables() on individual queries. This method takes additional parameters including scoped variables and request filters, enabling more comprehensive variable resolution.
In querySplitting.ts, template variable interpolation is now applied after basic query filtering (removing hidden queries and empty expressions) but before the splitting logic analyzes queries for partitioning strategies. The same pattern is implemented in shardQuerySplitting.ts for consistency.
The changes ensure that template variables are properly resolved before query splitting decisions are made, which is critical for accurate partitioning logic. Functions like querySupportsSplitting(), isLogsQuery(), and various partitioning functions now operate on fully interpolated query expressions rather than raw templates.
Comprehensive test coverage has been added to validate that variables like $__auto and $step are correctly interpolated to their actual values (e.g., '5m') before queries are executed. The test updates reflect the new per-query method call pattern, with call count expectations adjusted accordingly.
Confidence score: 4/5
- This refactoring improves the consistency and robustness of template variable handling in query splitting
- The change follows established Grafana datasource patterns and includes proper test coverage
- The files that need the most attention are the core splitting logic files to ensure the interpolation timing is correct
4 files reviewed, no comments
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had any further activity in the last 2 weeks. Thank you for your contributions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Test 4