-
Notifications
You must be signed in to change notification settings - Fork 715
fix: Update query recommendations BG job interval and update BG job strategy to use DB triggers to ensure singleton like behaviour across the cluster. #8817
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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 Overview
Summary
Fixes a critical configuration bug where the query recommendation background job interval was incorrectly set to 3600000000 (interpreted as ~1000 hours) instead of 3600 seconds (1 hour).
Key Changes:
- Changed
query_recommendation_analysis_intervalfrom 3600000000 to 3600 - Added clarifying unit comments:
// microsecondsfor duration and// secondsfor interval - Aligns with the intended behavior described in the inline comment: "Run Query Recommendation Analysis for last one hour for every hour"
This fix ensures the background job runs hourly as intended, rather than once every ~41.7 days, significantly improving the frequency of query optimization recommendations.
Confidence Score: 5/5
- This PR is safe to merge with no risk - it fixes a critical configuration bug
- The change is a simple configuration fix that corrects an obvious unit mismatch. The interval value of 3600000000 was clearly incorrect (would run every ~1000 hours), and the fix to 3600 seconds aligns perfectly with the comment stating the job should run every hour. The added unit comments improve code clarity and prevent future confusion.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/config/src/config.rs | 5/5 | Fixed query recommendation interval from 1000 hours to 1 hour, added clarifying unit comments |
Sequence Diagram
sequenceDiagram
participant BG as Background Job Scheduler
participant QRS as QueryRecommendationService
participant CFG as Config (config.rs)
participant ENG as OptimizerContext Engine
Note over CFG: Configuration Values<br/>duration: 3600000000 μs (1 hour)<br/>interval: 3600 s (1 hour)
BG->>QRS: Initialize with config values
QRS->>CFG: Read query_recommendation_analysis_interval (3600s)
QRS->>CFG: Read query_recommendation_duration (3600000000μs)
CFG-->>QRS: Return config values
loop Every 1 hour (interval)
QRS->>ENG: Trigger analysis
Note over ENG: Analyze last 1 hour<br/>of query usage data
ENG->>ENG: Generate recommendations
ENG-->>QRS: Return recommendations
QRS->>QRS: Wait for next interval (3600s)
end
1 file reviewed, no comments
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 334 | 0 | 19 | 11 | 92% | 4m 40s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 336 | 0 | 19 | 9 | 92% | 4m 39s |
2cd76d4 to
e856887
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 331 | 0 | 19 | 14 | 91% | 4m 39s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 334 | 0 | 19 | 11 | 92% | 4m 39s |
e8140d3 to
8cbceae
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 342 | 0 | 19 | 4 | 94% | 4m 38s |
…singleton execution can be guaranteed
8cbceae to
edb166e
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 343 | 0 | 19 | 3 | 94% | 4m 40s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 69 | 64 | 0 | 4 | 1 | 93% | 2m 39s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 344 | 0 | 19 | 2 | 94% | 4m 39s |
…trategy to use DB triggers to ensure singleton like behaviour across the cluster. (#8817) ### **User description** # PR Type Fix # Description Default config values of query recommendations generate far too few updates. Current change will generate a recommendation every one hour for the last one hour's usage. ___ ### **PR Type** Bug fix, Documentation ___ ### **Description** - Correct interval unit for recommendations - Clarify duration unit with comment - Keep hourly analysis intent intact ___ ### Diagram Walkthrough ```mermaid flowchart LR cfg["config.rs Limits"] -- "add unit comments" --> dur["ZO_QUERY_RECOMMENDATION_DURATION"] cfg -- "fix interval units" --> intv["ZO_QUERY_RECOMMENDATION_INTERVAL"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>config.rs</strong><dd><code>Fix recommendation interval default and document units</code> </dd></summary> <hr> src/config/src/config.rs <ul><li>Added unit comment to <code>ZO_QUERY_RECOMMENDATION_DURATION</code> (microseconds).<br> <li> Changed <code>ZO_QUERY_RECOMMENDATION_INTERVAL</code> default from 3600000000 to <br>3600 (seconds).<br> <li> Added unit comment to <code>ZO_QUERY_RECOMMENDATION_INTERVAL</code> (seconds).</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8817/files#diff-9aeee4a74c0520daa40f9b81c7016f5b6b3254375b968dd7598e745630980d62">+2/-2</a> </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
User description
PR Type
Fix
Description
Default config values of query recommendations generate far too few updates. Current change will generate a recommendation every one hour for the last one hour's usage.
PR Type
Bug fix, Documentation
Description
Correct interval unit for recommendations
Clarify duration unit with comment
Keep hourly analysis intent intact
Diagram Walkthrough
File Walkthrough
config.rs
Fix recommendation interval default and document unitssrc/config/src/config.rs
ZO_QUERY_RECOMMENDATION_DURATION(microseconds).ZO_QUERY_RECOMMENDATION_INTERVALdefault from 3600000000 to3600 (seconds).
ZO_QUERY_RECOMMENDATION_INTERVAL(seconds).