-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Alerting: Implement template preview for Grafana AlertManager #65530
Conversation
You have successfully added a new CodeQL configuration |
6c03168
to
8931d00
Compare
This pull request was removed from the 9.5.0 milestone because 9.5.0 is currently being released. |
7dc2dad
to
033b7a9
Compare
I noticed the request is called as |
yes, the final api is still WIP, so I decided not to update the request yet until we are sure about the final required request. |
I added an alert instance selector to the preview section so that users can select from existing alert instances to build the payload. The alert instances are consumed from Once one or more alerts are selected, a payload like the one defined in this document is created with the alerts information and shown in the payload editor:
Example: |
04d9fa1
to
8d2fbd4
Compare
…f alert data fields in preview
7126b74
to
fa5df4d
Compare
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.
Awesome work! Just one more nit but we can change that after it's merged
public/app/features/alerting/unified/components/receivers/TemplateForm.tsx
Outdated
Show resolved
Hide resolved
public/app/features/alerting/unified/components/receivers/form/GenerateAlertDataModal.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM!
* Add Preview template and payload editor to templates form * Add TemplatePreview test and update css * Preview errors for each template that is wrong * Enable preview templating only for Grafana Alert Manager * Use harcoded default payload instead of requesting it to the backend * Update error response in the api definition * Add spinner when loading result for preview * Update api request followind DD changes * Use pre instead of TextArea to render the preview * Fix tests * Add alert list editor * Add start and end time for alert generator * Add preview for data list added in the modal * Update copies and move submit button in alert generator to the bottom * Copy updates * Refactor * Use tab instead of button to preview * Move payload editor next to the content * Copy update * Refactor * Adress PR review comments * Fix wrong json format throwing an exception when adding more data * Use monaco editor for payload * Only show text 'Preview for...' when we have more than one define * Fix some errors * Update CollapseSection style * Add tooltip for the Payload info icon explaining the available list of alert data fields in preview * Set payload as invalid if it's not an array * Fix test * Update text in AlertTemplateDataTable * Add separators to distinguish lines that belong to the preview * Fix text * Use subDays instead of addDays for substracting days
What is this feature?
This PR adds the preview feature in templates form. This feature is only available for Grafana AlertManager.
Why do we need this feature?
This will help users understand the result of the template they are creating, by showing errors directly in the preview. This would prevent a lot of templating issues.
This PR also enables user to create alert data payload for the preview, not only editing it in a JSON editor but having an alert data editor, where user doesn't need to understand the exact JSON format for the payload.
Who is this feature for?
All users.
Fixes #61764
Special notes for your reviewer:
templatePreviewFE.mp4
Please check that: