add alert query mode metadata#1707
Conversation
persist queryType for alerts: builder, code, or promql defaults old alerts to builder accepts legacy queryType=sql as code reserves old creationType keys treats builder/code as SQL modes for auth and dataset resolution.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds ChangesAlertQueryType: enum, structs, trait, and auth
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/alerts/alert_types.rs`:
- Around line 94-97: The PromQL guard in validate() is too late because
Alerts::load still enqueues unsupported ThresholdAlert entries before
validation. Update the load/scheduling path so unsupported
AlertQueryType::Promql alerts are filtered out or marked disabled before
creating an AlertTask::Create, using the existing validate() /
AlertError::NotPresentInOSS logic as the source of truth. Make sure both
occurrences in alert_types.rs are covered so OSS never schedules PromQL alerts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: bd53268e-dd27-4454-a46a-b83b6e7fb28d
📒 Files selected for processing (8)
src/alerts/alert_enums.rssrc/alerts/alert_structs.rssrc/alerts/alert_traits.rssrc/alerts/alert_types.rssrc/alerts/mod.rssrc/handlers/http/alerts.rssrc/lib.rssrc/metastore/metastore_traits.rs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/alerts/mod.rs`:
- Around line 153-162: The OSS alert loading path is aborting on unsupported
alert types because `load()` propagates errors from `alert_from_config_oss`, so
a single anomaly or forecast config stops later alerts from being loaded. Update
the alert-loading logic in `load()` to mirror the unschedulable-alert handling
below by skipping `AlertError::NotPresentInOSS` cases instead of returning
early, while keeping supported `Threshold` alerts loaded normally through
`alert_from_config_oss`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
persist queryType for alerts: builder, code, or promql
defaults old alerts to builder
accepts legacy queryType=sql as code
reserves old creationType keys
treats builder/code as SQL modes for auth and dataset resolution
Summary by CodeRabbit
New Features
builder,code,promql) viaqueryType/query_type, preserved across requests and responses."sql"continues to work as an alias forcode; PromQL uses the provided dataset(s).Bug Fixes
Chores
queryType/query_typeand related fields, plus added JSON parsing coverage for query mode.