-
Notifications
You must be signed in to change notification settings - Fork 34
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
Move remaining notifiers from Grafana repository #26
Conversation
* Email notification channel in ngalert Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * Use existing templating system Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * Update template and add unit tests Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
…n service (#32175) * Alerting: Fetch configuration from the database and run a notification instance Co-Authored-By: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
* Render new email template and fix the title Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix nit Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* AlertingNG: PagerDuty notification channel Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Add tests Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix lint Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix reviews Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* AlertingNG: Slack notification channel Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Add tests Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix review comments Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix review comments and small refactoring Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* NGAlert: Don't use pkg/errors Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/services/ngalert/notifier/alertmanager.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * Fix logging Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
* Slack: Use only chat.postMessage API Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Slack: Check for response error Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Slack: Support custom webhook URL Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Simplify Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix tests Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Rewrite tests to use stdlib Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/services/alerting/notifiers/slack.go Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com> * Clarify URL field name Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix linting issue Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix test Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix up new Slack notifier Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Improve tests Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix lint Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Slack: Make token not required Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Alerting: Send validation errors back to client Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Document how token is required Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Make recipient required when using Slack API Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix field description Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com>
* AlertingNG: Fix TODOs in email notification channel Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Test fixup * Remove the receiver field it is not needed for the email notification Co-authored-by: Josue Abreu <josue@grafana.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
… (#33489) Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* NGAlert: Add integration tests for notification channels Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix the failing tests Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix review comments Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Override creation of rule UID, remove only namespace UID Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Alerting: Allow the notifier to log The notifier upstream code uses go-kit as its logging library. The grafana specific logger is not compatible with this API. In this PR, I have created a wrapper that implements io.Writer to make them compatible.
…036) Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Alerting: Port Alertmanager notifier to v8 Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add discord notifier channel and test * Correct payload * remove print statement * PR feedback and update due to changes in main * Add discord notifier channel and test * Correct payload * remove print statement * PR feedback and update due to changes in main * update constructor and tests * group imports sensibly * Fix lint Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Alerting: Opsgenie notification channel This translate the opsgenie notification channel from the old alerting system to the new alerting system with a few changes: - The tag system has been replaced in favour of annotation. - TBD - TBD Signed-off-by: Josue Abreu <josue@grafana.com> * Fix template URL * Bugfig: dont send resolved when autoClose is false Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix integration tests Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix URLs in all other channels Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
…34662) Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* NGAlert: Update the default template to include more URLs Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> * Fix tests Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
…fier (#33355) Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Move mentions to a markdown-formatted pretext field to prevent issues mixing blocks and legacy-attachment content.
fix broken links to image assets
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
This change preallocates slices and maps where the size of the data is known before the object is created. Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
This commit makes a number of changes to how images work in Slack notifications. It adds support for uploading images to Slack via the files.upload API when the contact point has a token. Images are no longer linked via a URL if a token is present. Each image uploaded to Slack is posted as a reply to the original notification. Up to maxImagesPerThreadTs images can be posted as replies before a final message is sent with: There are no images than can be shown here. To see the panels for all firing and resolved alerts please check Grafana Incoming Webhooks cannot upload files via files.upload and so webhooks require the image to be uploaded to cloud storage and linked via URL.
…ot needed anymore (#60178)
…manager (#59339) * Move truncation code to util to mirror upstream * Resolve merge conflicts * Align logging of alert key * Update tests and fix field passing bug * Remove superfluous newline in test now that we trim whitespace * Uptake minor log changes from upstream
…ing notifiers (#60271) * create sender service interface and bridge to grafana notifier service * update notifiers to use local sender interface
…ge (#60358) * remove intermediate struct to create Base struct * fix alertmanager
… (#60361) * introduce Logger interface local to channles + implementaton that wraps the Grafana logger * make NewFactoryConfig accept LoggerFactory * add logger field to FactoryConfig * update usages of log.Logger to internal interface
…ionChannelConfig (#60423) * introduce alias for json.RawMessage with name RawMessage. This is needed to keep raw JSON and implement a marshaler for YAML, which does not seem to be used but there are tests that fail. * replace usage of simplejson with RawMessage in NotificationChannelConfig * remove usage of simplejson in tests * change migration code to convert simplejson to raw message
* update remaining notifiers to use alerting package
…e settings instead of simplejson (#55507) * replace basic auth header with method call Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
… to use encoding/json to parse settings (#60542) also, rename Content to Message to match JSON name for Discord and GoogleChat
…s (#60593) Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
…hook message + truncate long message (#60592) * replace simplejson with models * truncate too long messages Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
* refactor email to not use simplejson * add tests * split integration test and unit test + more unit-tests * Remove outdated comment Co-authored-by: Armand Grillet <2117580+armandgrillet@users.noreply.github.com>
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 👍
I see that trailing newlines have been deleted from every file. This could be an issue for some linters. Otherwise it's good to go.
func (dd *DingDingNotifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error) { | ||
dd.log.Info("sending dingding") | ||
|
||
dingDingURL := buildDingDingURL(dd) |
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.
Good to see that variable names for acronyms like "URL" are now following Go conventions! :)
This is the last part of the moving notifiers from the Grafana repository