Default Grafana alert RuleQuery interval to 30s#2229
Open
cawthorne wants to merge 2 commits into
Open
Conversation
Sets interval on Prometheus datasource query models (refId A) so deployed alert rules no longer default to 1s evaluation in Grafana UI.
Contributor
|
👋 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! |
Contributor
✅ API Diff Results -
|
Contributor
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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