Default Grafana alert RuleQuery interval to 30s - #2229
Conversation
Sets interval on Prometheus datasource query models (refId A) so deployed alert rules no longer default to 1s evaluation in Grafana UI.
|
👋 cawthorne, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
✅ API Diff Results -
|
There was a problem hiding this comment.
Pull request overview
Adds a default Prometheus query interval for Grafana alert rule query models to avoid generated rules showing a 1s datasource step by default, aligning the alert rule “refId A” query step with the intended 30s evaluation cadence.
Changes:
- Introduces
RuleQuery.Intervalwith a default of"30s"and applies it innewRuleQueryfor Prometheus datasource query models (refIdA). - Reuses a shared
defaultRuleQueryIntervalMsconstant for condition queryintervalMsdefaults. - Adds a unit test validating the default interval is set on the Prometheus query model.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
observability-lib/grafana/alerts.go |
Adds default rule query interval support and reuses a shared interval constant for condition query defaults. |
observability-lib/grafana/builder_test.go |
Adds coverage to ensure the Prometheus query model interval defaults to "30s". |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses review feedback to avoid drift between the Prometheus query interval string and condition step intervalMs defaults.
|
This PR is stale because it has been open 30 days with no activity. |
Summary
RuleQuery.Intervalto observability-lib with a default of"30s".intervalon Prometheus datasource query models (refIdA) innewRuleQuery, so deployed Grafana alert rules no longer show 1s on the datasource step.defaultRuleQueryIntervalMsconstant for condition query defaults.TestNewAlertRule_DefaultRuleQueryInterval.Companion to chainlink-observability#467, which sets rule group evaluation intervals and condition
intervalMsin chainlink-observability. This PR covers the remaining alert rule model layer: the Prometheus query step (refIdA).Coverage
Evaluate every)intervalMs(B/C)Test plan
go test ./observability-lib/grafana/...observability-libin chainlink-observability and verify refAshows"interval": "30s"in generated alert JSON