feat: add grafana create, update and delete alert rules #3873
Merged
forestileao merged 27 commits intosuperplanehq:mainfrom Apr 13, 2026
Merged
feat: add grafana create, update and delete alert rules #3873forestileao merged 27 commits intosuperplanehq:mainfrom
forestileao merged 27 commits intosuperplanehq:mainfrom
Conversation
|
👋 Commands for maintainers:
|
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
bc9e1fa to
f3c0555
Compare
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Collaborator
Author
Screencast.from.2026-04-03.10-48-59.webmScreencast.from.2026-04-03.10-54-32.webm |
- Added validation for `For`, `NoDataState`, and `ExecErrState` fields in `CreateAlertRuleSpec` and `UpdateAlertRuleSpec` to ensure they are not empty and conform to expected formats. - Introduced helper functions `isValidDuration`, `isValidNoDataState`, and `isValidExecErrState` to validate respective fields. - Added unit tests to cover new validation scenarios, ensuring robust error handling for invalid inputs. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
- Changed alert rule condition from "A" to "C" across multiple JSON files. - Introduced new query models for alert rules, including a "reduce" model and a "threshold" model, enhancing the alerting capabilities. - Updated the data structure to support additional references and expressions for improved alert evaluation. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
- Changed alert rule condition from "A" to "C" in multiple sections of the Grafana documentation. - Added new query models, including "reduce" and "threshold", to improve alert evaluation capabilities. - Updated data structures to support additional references and expressions for enhanced alerting functionality. Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
forestileao
reviewed
Apr 10, 2026
forestileao
reviewed
Apr 10, 2026
forestileao
reviewed
Apr 10, 2026
forestileao
reviewed
Apr 10, 2026
forestileao
reviewed
Apr 10, 2026
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 87ffad3. Configure here.
forestileao
approved these changes
Apr 13, 2026
0vertake
pushed a commit
to 0vertake/superplane
that referenced
this pull request
Apr 13, 2026
…#3873) Implements: superplanehq#3850 This expands the Grafana Integration by adding three components: - `grafana.CreateAlertRule` - `grafana.UpdateAlertRule` - `grafana.DeleteAlertRule` - `grafana.ListAlertRules` - `grafana.GetAlertRule` ### Demo Video [Screencast from 2026-04-01 12-37-35.webm](https://github.com/user-attachments/assets/831343d3-cf4d-4159-a49f-b82b81f438dc) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Adds new Grafana Alerting Provisioning API write paths (create/update/delete) plus new resource listing logic and stricter webhook provisioning behavior, which could impact existing Grafana integrations if permissions or payload merging are incorrect. > > **Overview** > Expands the Grafana integration to manage **Grafana-managed alert rules** via the Alerting Provisioning HTTP API, adding new workflow components to `create`, `get`, `list`, `update` (partial merge), and `delete` alert rules, along with example outputs and UI mappers for rendering metadata/execution details. > > Introduces shared alert-rule spec decoding/sanitization/validation and payload building/merging (including contact point attach/clear semantics, provenance checks, deep-clone safety, and condition/query rebuild logic), and extends the Grafana client with alert-rule/folder endpoints plus a mutex to serialize notification policy tree updates. > > Tightens Grafana webhook setup to **fail fast** instead of falling back to manual setup on client/provisioning failures, and updates `Query Data Source` configuration by renaming `dataSourceUid` to `dataSource`, removing the timezone field, and interpreting datetime-local inputs as UTC (with stricter timezone requirements added for annotation datetime-local parsing). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 87ffad3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
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.

Implements: #3850
This expands the Grafana Integration by adding three components:
grafana.CreateAlertRulegrafana.UpdateAlertRulegrafana.DeleteAlertRulegrafana.ListAlertRulesgrafana.GetAlertRuleDemo Video
Screencast.from.2026-04-01.12-37-35.webm
Note
Medium Risk
Adds new Grafana Alerting Provisioning API write paths (create/update/delete) plus new resource listing logic and stricter webhook provisioning behavior, which could impact existing Grafana integrations if permissions or payload merging are incorrect.
Overview
Expands the Grafana integration to manage Grafana-managed alert rules via the Alerting Provisioning HTTP API, adding new workflow components to
create,get,list,update(partial merge), anddeletealert rules, along with example outputs and UI mappers for rendering metadata/execution details.Introduces shared alert-rule spec decoding/sanitization/validation and payload building/merging (including contact point attach/clear semantics, provenance checks, deep-clone safety, and condition/query rebuild logic), and extends the Grafana client with alert-rule/folder endpoints plus a mutex to serialize notification policy tree updates.
Tightens Grafana webhook setup to fail fast instead of falling back to manual setup on client/provisioning failures, and updates
Query Data Sourceconfiguration by renamingdataSourceUidtodataSource, removing the timezone field, and interpreting datetime-local inputs as UTC (with stricter timezone requirements added for annotation datetime-local parsing).Reviewed by Cursor Bugbot for commit 87ffad3. Bugbot is set up for automated code reviews on this repo. Configure here.