-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix: AlertRulev9 JSON schema is not correct #544
Conversation
Thanks for the PR, I will give this a test with my alert rules as I have not seen this issue, but then I am not uploading via the API. |
Interesting, how are you uploading the alerts? By provisioning? |
Yeah I use the file based provisioning. |
This looks to be the format that Grafana uses internally, if you open Inspect Element and go to the Alerting tab of Grafana, then search for the request to Out of curiosity, if you find one of the alerts you uploaded using file-based provisioning inside this response, what structure does it use? |
Just a FYI I also tested this PR in our project and it's working perfectly. Was having a hard time figuring out what was happening. Thanks! |
Thanks @hugohaa! Is there any possibility I could get a second look at this PR @JamesGibo? |
We are also using the API to upload our alerts, and had to merge this PR for it to work. Thanks @OscarVanL |
Are there plans to merge this PR? :) |
This looks good, and can confirm it fixes errors when pushing alerts to the unified alerting API. |
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.
Looks good to me, I have not tested the updated JSON format, but will test it before publishing a release
@JamesGibo Is there any plan to release the latest version including this fix? |
+1 here, any idea on the next release for this, @JamesGibo? |
There are a couple of mistakes in the Grafana 9 Alerts-As-Code
AlertRulev9
JSON output.Firstly, the absence of
grafana_alert
means that uploading the output JSON fails with a validation error:{"message":"unexpected backend type (grafana) for payload type (lotex)","traceID":""}
, which specifically is this error in Grafana.Secondly, the fields
noDataState
andexecErrState
were renamed tono_data_state
andexec_err_state
in v9, meaning these settings were not applied correctly.With these changes my alerts upload successfully and appear to be correct, but if I spot further mistakes I'll make follow-up PRs.