Fix rendering AlertRulev9 json for possible use in Alerting provisioning API#568
Fix rendering AlertRulev9 json for possible use in Alerting provisioning API#568ilia-ilin-jiji wants to merge 4 commits intoweaveworks:mainfrom
Conversation
…ataSourceForTargets class Signed-off-by: Ilia Ilin <ilia.ilin@jiji.ng>
Signed-off-by: Ilia Ilin <ilia.ilin@jiji.ng>
Signed-off-by: Ilia Ilin <ilia.ilin@jiji.ng>
…_type param for DataSource class Signed-off-by: Ilia Ilin <ilia.ilin@jiji.ng>
| "data": data, | ||
| "noDataState": self.noDataAlertState, | ||
| "execErrState": self.errorAlertState | ||
| "execErrState": self.errorAlertState, |
There was a problem hiding this comment.
Are you sure that this model is correct? According to this API: https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/pkg/services/ngalert/api/tooling/post.json looks that grafana_alert object is required for grafana managed alerts 🤔
There was a problem hiding this comment.
Please could you remove this part from the PR
|
#544 Has the correct implementation of this fix. @KacperLegowski is right that alerts need a nested grafana_alert object. |
| folderUid = attr.ib(default=None, validator=attr.validators.optional(instance_of(str))) | ||
| ruleGroup = attr.ib(default=None, validator=attr.validators.optional(instance_of(str))) |
There was a problem hiding this comment.
Add document string for these
JamesGibo
left a comment
There was a problem hiding this comment.
Thanks for the PR, there looks like there are some really useful improvements in the PR.
Would you be bale to-do the following:
- rebase on master
- Remove the incorrect
- Add documentation strings for the additional fields you have added
Gnappuraz
left a comment
There was a problem hiding this comment.
I would be happy to help out on this. I'm currently trying to use the lib to implement alert provisioning via the new API but I'm struggling because of this and other issues.
| "data": data, | ||
| "noDataState": self.noDataAlertState, | ||
| "execErrState": self.errorAlertState | ||
| "execErrState": self.errorAlertState, |
There was a problem hiding this comment.
| "execErrState": self.errorAlertState, |
| :param uid: Alert UID should be unique | ||
| :param dashboard_uid: Dashboard UID that should be use for linking on alert message | ||
| :param panel_id: Panel ID that should should be use for linking on alert message | ||
| :param panel_id: Panel ID that should be use for linking on alert message |
There was a problem hiding this comment.
| :param panel_id: Panel ID that should be use for linking on alert message | |
| :param panel_id: Panel ID that should be used for linking on alert message | |
| :param annotations: An array of additional annotations, can be used for alert message | |
| :param labels: An array of labels, can be used with Notification Policies | |
| :param folderUid: Folder ID that should be use for linking on alert message | |
| :param ruleGroup: A group for alerts that are evaluated together |
Gnappuraz
left a comment
There was a problem hiding this comment.
I would be happy to help out on this. I'm currently trying to use the lib to implement alert provisioning via the new API but I'm struggling because of this and other issues.
Gnappuraz
left a comment
There was a problem hiding this comment.
I would be happy to help out on this. I'm currently trying to use the lib to implement alert provisioning via the new API but I'm struggling because of this and other issues.
What does this do?
This PR fix generates the correct json for HTTP API requests.
panel_idanddashboard_uidbut didn't use in json generating.labelsandannotationsparams because are work incorrectly. If I change param in one alert is changed in allWhy is it a good idea?
Context
Questions