-
Notifications
You must be signed in to change notification settings - Fork 316
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 rendering AlertRulev9 json for possible use in Alerting provisioning API #568
base: main
Are you sure you want to change the base?
Fix rendering AlertRulev9 json for possible use in Alerting provisioning API #568
Conversation
…ataSourceForTargets class Signed-off-by: Ilia Ilin <[email protected]>
Signed-off-by: Ilia Ilin <[email protected]>
Signed-off-by: Ilia Ilin <[email protected]>
…_type param for DataSource class Signed-off-by: Ilia Ilin <[email protected]>
@@ -1633,7 +1653,9 @@ def to_json_data(self): | |||
"annotations": self.annotations, | |||
"data": data, | |||
"noDataState": self.noDataAlertState, | |||
"execErrState": self.errorAlertState | |||
"execErrState": self.errorAlertState, |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add document string for these
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.
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
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.
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.
@@ -1633,7 +1653,9 @@ def to_json_data(self): | |||
"annotations": self.annotations, | |||
"data": data, | |||
"noDataState": self.noDataAlertState, | |||
"execErrState": self.errorAlertState | |||
"execErrState": self.errorAlertState, |
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.
"execErrState": self.errorAlertState, |
@@ -1574,13 +1586,15 @@ class AlertRulev9(object): | |||
:param timeRangeTo: Time range interpolation data finish at | |||
: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: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 |
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.
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.
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.
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_id
anddashboard_uid
but didn't use in json generating.labels
andannotations
params because are work incorrectly. If I change param in one alert is changed in allWhy is it a good idea?
Context
Questions