Skip to content
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

Import all Alertmanager files from grafana/grafana #9

Merged
merged 199 commits into from
Jul 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
b731974
AlertingNG: Add alert provider and basic structure with dispatcher, s…
codesome Mar 16, 2021
a7e77a1
AlertingNG: Fix the alerting stage for legacy alerts (#32025)
codesome Mar 17, 2021
843e1ab
AlertingNG: Notification channel for emails (#31768)
codesome Mar 18, 2021
7a77977
AlertingNG: Refactor notifier to support config reloads (#32099)
codesome Mar 19, 2021
65f91f2
Alerting: Fetch configuration from the database and run a notificatio…
gotjosh Mar 24, 2021
70de2b2
Upgrade Prometheus Alertmanager and small fixes (#32280)
codesome Mar 25, 2021
38e9435
Render new email template and fix the title (#32314)
codesome Mar 26, 2021
6621471
AlertingNG: Fix dispatcher metrics in notifier (#32434)
codesome Mar 29, 2021
bc037d0
Alerting: Send alerts from state tracker to notifier, logging, and cl…
davidmparrott Mar 30, 2021
4e05ddf
Alerting: Introduce the silencing interface (#32517)
gotjosh Mar 31, 2021
56c6e28
[Alerting]: Alertmanager API implementation (#32174)
papagian Mar 31, 2021
7d6bfc6
Update email template for AlertingNG (#32691)
codesome Apr 7, 2021
597d1e5
Alerting: Allow querying of Alerts from notifications (#32614)
gotjosh Apr 8, 2021
d3d6215
AlertingNG: Add a global registry for notification channels (#32781)
codesome Apr 8, 2021
c879bc3
AlertingNG: PagerDuty notification channel (#32604)
codesome Apr 8, 2021
c20e7a9
Packages: Tyring to fix missing css prop issue caused by emotion (#32…
torkelo Apr 8, 2021
f196117
Alerting: Use a default configuration and periodically poll for new o…
gotjosh Apr 13, 2021
24872eb
AlertingNG: Slack notification channel (#32675)
codesome Apr 15, 2021
1e28c3c
AlertingNG: Remove the receivers field from postable alerts (#33068)
codesome Apr 19, 2021
22530e8
Inhouse alerting api (#33129)
owen-d Apr 19, 2021
3e59456
Alerting: Various fixes for the alerts endpoint (#33182)
gotjosh Apr 21, 2021
4fbb6f2
NGAlert: Consolidate on standard errors package (#33249)
aknuds1 Apr 22, 2021
0d3494f
Slack: Use chat.postMessage API by default (#32511)
aknuds1 Apr 22, 2021
3345b48
AlertingNG: Fix TODOs in email notification channel (#33169)
codesome Apr 22, 2021
54dd9a2
AlertingNG: Correctly set StartsAt, EndsAt, UpdatedAt after alert rec…
codesome Apr 22, 2021
e07de59
AlertingNG: Add Telegram notification channel (#32795)
codesome Apr 22, 2021
adf8b66
AlertingNG: Add Teams notification channel (#32979)
codesome Apr 22, 2021
525588c
AlertingNG: Add Dingding notification channel (#32995)
codesome Apr 22, 2021
cf3d4e5
AlertingNG: Add webhook notification channel (#33229)
codesome Apr 23, 2021
bf9984e
NGAlert: Run the maintenance cycle for the silences (#33301)
codesome Apr 23, 2021
8d0a10a
NGAlert: Fix flaky test (#33415)
codesome Apr 27, 2021
652ccc1
Alerting/metrics (#33547)
owen-d Apr 30, 2021
53ef4dc
NGAlert: Send list of available ngalert notification channels via API…
codesome May 4, 2021
4dd23ce
NGAlert: Fix some TODOs in notification channels (#33739)
codesome May 5, 2021
2cacb16
[Alerting]: store encrypted receiver secure settings (#33832)
papagian May 10, 2021
5ffd282
NGAlert: Fix templating and remove unwanted default templates (#33918)
codesome May 12, 2021
479adf8
NGAlert: Fix unit test to write files in temporary directory (#34032)
codesome May 13, 2021
1185be0
NGAlert: Add integration tests for notification channels (#33431)
codesome May 13, 2021
b091761
extracts alertmanager from DI, including migrations (#34071)
owen-d May 13, 2021
af2b341
Alerting: Modify configuration apply and save semantics - v2 (#34143)
gotjosh May 14, 2021
f921e9a
Alerting/ruler metrics (#34144)
owen-d May 14, 2021
b791a64
NGAlert: Add message field to email notification channel (#34044)
codesome May 17, 2021
250f203
Alerting: Allow the notifier to log (#34232)
gotjosh May 17, 2021
3aa625a
NGAlert: Remove unwanted fields from notification channel config (#34…
codesome May 18, 2021
080984d
[Alerting]: Add Sensu Go integration with the alert manager (#34045)
papagian May 18, 2021
297a496
Alerting: Migrate Alertmanager notifier (#34304)
aknuds1 May 19, 2021
fa672bf
[Alerting]: Add Pushover integration with the alert manager (#34371)
papagian May 19, 2021
fd9fb11
Add discord notifier channel and test (#34150)
davidmparrott May 19, 2021
ed867fa
NGAlert: Add GoogleChat notification channel (#34153)
codesome May 19, 2021
eed15b6
Alerting: update email template (#34205)
domasx2 May 19, 2021
cc5b742
NGAlert: Add Line notification channel (#34157)
codesome May 19, 2021
94d324a
NGAlert: Add VictorOps notification channel (#34161)
codesome May 19, 2021
a325327
NGAlert: Add Kafka notification channel (#34156)
codesome May 19, 2021
3346f83
NGAlert: Add Threema notification channel (#34159)
codesome May 19, 2021
e0fcfc5
Alerting: Opsgenie notification channel (#34418)
gotjosh May 20, 2021
4f29f9c
[Alerting]: namespace fixes (#34470)
papagian May 20, 2021
7adbec7
[Alerting]: alertmanager notifier fixes (#34575)
papagian May 24, 2021
93b06b9
NGAlert: Add integration tests for remaining notification channels (#…
codesome May 26, 2021
de0c551
NGAlert: Update the default template to include more URLs (#34715)
codesome May 26, 2021
e7b8d01
Clarify that Threema Gateway Alerts support only Basic IDs (#34828)
dbrgn May 28, 2021
0b95122
alerting: fixes per-receiver metric cardinality (#34915)
owen-d May 28, 2021
0156d74
Alerting: Add support for configuring avatar URL for the Discord noti…
ChipWolf May 28, 2021
6becb8a
Alerting: Migrate tags as labels and not annotations (#34990)
codesome May 31, 2021
3f079c7
Alerting: Do not hard fail on templating errors in channels (#35165)
codesome Jun 3, 2021
0daece3
Alerting: Implement /status for the notification system (#33227)
gotjosh Jun 15, 2021
ff597f8
Alerting: Decouple default template from channel tests (#35239)
codesome Jun 21, 2021
891b0f1
Alerting: Template all possible variables in notification channels (#…
codesome Jun 22, 2021
7a3670c
Alerting: Change `__value__` label to `__value_string__` annotation a…
kylebrandt Jun 24, 2021
37326c3
Alerting: Add additional newlines to Microsoft Teams notification mes…
codesome Jun 24, 2021
3cd0b60
Alerting: Allow space in label and annotation names (#36549)
codesome Jul 8, 2021
b17db81
Alerting: Fix potential panic in Alertmanager when starting up (#36562)
codesome Jul 12, 2021
62f2f9e
Alerting: A better and cleaner way to know if Alertmanager is initial…
codesome Jul 12, 2021
1c5a281
Alerting: deactivate an Alertmanager configuration (#36794)
papagian Jul 16, 2021
dfc1955
Alerting: Improve receiver initialisation errors (#36814)
papagian Jul 19, 2021
22bbe8d
Email: Allow configuration of content types for email notifications (…
djairhogeuens Jul 19, 2021
cafac82
Alerting: Remove the fixed wait for notification delivery (#37203)
codesome Jul 26, 2021
facb65f
Alerting: Remove unused fields in Pagerduty struct (#37198)
codesome Jul 27, 2021
332bb5b
Alerting: Send alerts to external Alertmanager(s) (#37298)
gotjosh Aug 6, 2021
fba8d88
Alerting frontend : fix line notifier (#37744)
xy-man Aug 10, 2021
9a04c5b
Alerting: modify DB table, accessors and migration to restrict org ac…
papagian Aug 12, 2021
7223532
Contact point testing (#37308)
grobinson-grafana Aug 17, 2021
b27595c
Alerting: button to test contact point (#37475)
domasx2 Aug 18, 2021
a931503
Alerting: create wrapper for Alertmanager to enable org level isolati…
davidmparrott Aug 24, 2021
599215c
Alerting: Fix flake on test receiver tests (#38511)
gotjosh Aug 24, 2021
6d4891b
Alerting: Fix notifier tests to close the temp file (#38992)
Sep 9, 2021
525fbcf
Alerting: Persist notification log and silences to the database (#39005)
gotjosh Sep 9, 2021
af5d526
Chore: Disable backend test for now since it adds 10 minutes extra in…
marefr Sep 13, 2021
fbcc5fb
Alerting: Refactor & fix unified alerting metrics structure (#39151)
gotjosh Sep 14, 2021
814c098
Alerting: Fix bug not creating filepath for silences/nflog if it does…
gotjosh Sep 14, 2021
63f6b7c
Alerting: Cleanup template, silence and notification files created du…
santihernandezc Sep 15, 2021
ae88553
Alerting: Support Unified Alerting with Grafana HA (#37920)
gotjosh Sep 16, 2021
3f42f59
Provide reader to alertmanager silence instead of file path (#39305)
Sep 17, 2021
b1e7781
Alerting: Move the unified alerting settings to its own struct (#39350)
gotjosh Sep 20, 2021
a4f24bb
Alerting: Optimization of fetching data in multiorg alertmanager (#3…
yuri-tceretian Sep 21, 2021
ad591f6
Alerting: Move alertmanager default config to UnifiedAlertingSettings…
yuri-tceretian Sep 23, 2021
e041c3a
Alerting: tune rule evaluation via configuration (#35623)
papagian Sep 28, 2021
21d277e
Alerting: Remove `ngalert` feature toggle and introduce two new setti…
papagian Sep 29, 2021
2d2badc
Alerting: Remove extra field orgId from notifier.Alertmanager (#39870)
Oct 1, 2021
3754fb5
Alerting: Allow more characters in label names so notifications are s…
gotjosh Oct 4, 2021
53183d3
Encryption: Refactor securejsondata.SecureJsonData to stop relying on…
joanlopez Oct 7, 2021
0307aad
Alerting: declare constants for __dashboardUid__ and __panelId__ lite…
yuri-tceretian Oct 7, 2021
22fef1b
Alerting: add organziation ID to the ngAlert webhook payload (#40189)
JohnnyQQQQ Oct 8, 2021
b4163cc
Alerting: Fix error message in ngalert when notifications cannot be s…
grobinson-grafana Oct 11, 2021
f8597e6
Alerting: cleanup alert resources on org removal (#39938)
JohnnyQQQQ Oct 12, 2021
b199c71
Alerting: Fixes a bug when trying to sync broken alertmanager config …
gotjosh Oct 12, 2021
3d59050
Alerting: delete orphaned records from kvstore (#40337)
JohnnyQQQQ Oct 14, 2021
1a3685b
Remove flakiness of google chat tests (#40592)
Oct 19, 2021
9485d36
Fix panic when Slack API sends unexpected response (#40721)
santihernandezc Oct 21, 2021
ff054f5
Alerting: Support custom annotations and labels when testing contact …
grobinson-grafana Oct 21, 2021
932aff2
Alerting: Validate contact point configuration during migration to Un…
gotjosh Oct 22, 2021
b5f2dd9
Fix slack contact point panic (code review changes) (#40770)
santihernandezc Oct 22, 2021
e39f420
Alerting: Option for Discord notifier to use webhook name (#40463)
Skyedra Oct 26, 2021
f30fd98
Fix issues with Slack contact points (#40953)
santihernandezc Oct 27, 2021
1581aa2
Alerting: Update references to alertmanager (#40904)
yuri-tceretian Oct 29, 2021
7e38a53
Encryption: Use secrets service (#40251)
undef1nd Nov 4, 2021
f33ec47
remove the global log error/warn etc functions (#41404)
ying-jeanne Nov 8, 2021
a3b3520
Alerting: support mute timings configuration through the api for the …
JohnnyQQQQ Nov 19, 2021
05b77af
Alerting: Add value to notifier template (#41951)
peterholmberg Nov 22, 2021
744de2b
Alerting: Check for nil model.Settings and models.SecureSettings (#37…
grobinson-grafana Nov 22, 2021
eb3ec76
Alerting: Fix API specification (#42282)
papagian Nov 30, 2021
4c3d77d
Fix flaky tests in several notifiers (#42668)
gotjosh Dec 3, 2021
8522a53
Improve bridge for Alertmanager logger (#42958)
Dec 13, 2021
90c64c7
Alerting: Support WeCom as a contact point type (#40975)
smallpath Dec 15, 2021
585ea45
Alerting: use HTML-safe characters for the default template (#43148)
gillesdemey Dec 15, 2021
ea00f2b
Alerting: fix WeCom channel notifier test assertion (#43173)
gillesdemey Dec 15, 2021
2df17e4
Alerting: fix gosec warning that is not valid (#43425)
JohnnyQQQQ Dec 21, 2021
72ed3ae
Alerting: Fix global state sensitivity in notifier channel tests (#43…
alexweav Dec 27, 2021
202a577
Alerting: Allow configuration of non-ready alertmanagers (#43063)
alexweav Dec 27, 2021
552dac0
Chore: Remove context.TODO (#43458)
idafurjes Dec 28, 2021
fc2d913
Rename AddHandlerCtx to AddHandler (#43557)
idafurjes Dec 28, 2021
4299006
Rename DispatchCtx to Dispatch (#43563)
idafurjes Dec 28, 2021
be85c2d
Alerting: Allow customization of Google chat message (#43568)
alexweav Jan 5, 2022
1404a77
Alerting: Remove bridge between log15 and go-kit logger (#43769)
Jan 7, 2022
099bdbe
Chore: Remove bus from ngalert (#44465)
zserge Jan 26, 2022
8d71a0b
Remove bus from org invite api (#44530)
idafurjes Jan 31, 2022
828e97a
Fix Discord Webhook URL for invalid template (#44763)
grobinson-grafana Feb 2, 2022
f3a4015
Add context.Context to AlertingStore (#45069)
grobinson-grafana Feb 9, 2022
0cc3bb3
Alerting: add field for custom slack endpoint (#45751)
nathanrodman Feb 23, 2022
5b45a57
Alerting: Add validation to slack contact point (#45618)
peterholmberg Feb 25, 2022
484654f
Capitalize Webhook contact point type (#45942)
armandgrillet Feb 26, 2022
746ce02
Alerting: Add integration tests for dual-stage email templating (#43484)
alexweav Mar 1, 2022
5e06f75
Alerting: Fix silence url in notifications (#46031)
konrad147 Mar 2, 2022
ab7a360
Alerting: refactor receiver validation to be reusable (#46103)
JohnnyQQQQ Mar 14, 2022
d1f7cbb
Chore: Remove bus from notification service (#46813)
zserge Mar 22, 2022
d623843
test: use `T.TempDir` to create temporary test directory (#44947)
Juneezee Mar 22, 2022
394b58a
Alerting: add collision safe update function for alertmanager configu…
JohnnyQQQQ Mar 23, 2022
8eccd07
Unified Alerting, Issue 41156: Clean up expired silences. (#46740)
joeblubaugh Mar 23, 2022
aaa848e
Unified Alerting: Make log message follow codebase convention. (#46881)
joeblubaugh Mar 23, 2022
74351bf
Alerting: Add resolved count to notification title when both firing a…
JacobsonMT Mar 29, 2022
60b0418
Fix empty contact point URLs when template parsing fails (#47029)
santihernandezc Mar 31, 2022
18b6ee0
Alerting: Provisioning API - Notification Policies (#46755)
alexweav Apr 5, 2022
4b2d810
Temporarily skip intermittent test (#47471)
alexweav Apr 7, 2022
3e7b849
47470: Add additional delay to silences in test. (#47482)
joeblubaugh Apr 8, 2022
d16b82f
Alerting: Refactor GET/POST alerting config routes to be more extensi…
alexweav Apr 14, 2022
9668c48
Alerting: Fix issue with Slack contact point validation (#47559)
peterholmberg Apr 20, 2022
943d477
Indicate whether routes are provisioned when GETting Alertmanager con…
alexweav Apr 22, 2022
b9dd8c3
Drop ProvenanceOrgAdapter and build into store API instead (#48137)
alexweav Apr 26, 2022
86d7434
Alerting: Add additional customisation to ngalert MS Teams notifier (…
mucho-al-dente Apr 27, 2022
e36e541
Alerting: indicate whether contact point is provisioned (#48323)
JohnnyQQQQ Apr 27, 2022
16896dd
Fix Discord notifications not being sent due to templating issues (#4…
santihernandezc Apr 28, 2022
88f4677
Indicate whether templates are provisioned (#49025)
alexweav May 18, 2022
2b078ad
Alerting: Attach screenshot data to Slack notifications. (#49374)
joeblubaugh May 23, 2022
5e9a828
Alerting: Add Screenshot URLs to Pagerduty Notifier (#49377)
joeblubaugh May 23, 2022
4aaa2ef
Alerting: Attach image URL to alerts in Webhook notifier format. (#49…
joeblubaugh May 23, 2022
852df6d
Alerting: Add Image URLs to Microsoft Teams notifier. (#49385)
joeblubaugh May 23, 2022
7408fed
Alerting: Add image_urls to OpsGenie notification details. (#49379)
joeblubaugh May 23, 2022
e83cd70
Alerting: Add image url or file attachment to email notifications. (#…
joeblubaugh May 23, 2022
139ecb0
Alerting: Attach image URLs or upload files to Discord notifications.…
alexweav May 23, 2022
b5b8cf0
Alerting: Attach image URLs to Google Chat notifications. (#49445)
alexweav May 23, 2022
3e3d58a
sqlstore: finish removing Find and SearchDashboards (#49347)
mildwonkey May 24, 2022
a42a9d6
Alerting: Add stored screenshot utilities to the channels package. (#…
joeblubaugh May 26, 2022
78c77fa
Alerting: Do not include button in googlechat notification if URL inv…
j6s May 26, 2022
d6572d3
Alerting: Add tests for Slack Notifier Image Upload (#49669)
joeblubaugh May 27, 2022
7169c8d
Alerting: Add GetImages to ImageStore (#49717)
grobinson-grafana May 30, 2022
8dbeaa3
Alerting: Add templated subject config to email notifier (#49742)
JacobsonMT May 30, 2022
77b2162
Alerting: Remove Image Upload code from Slack notifier. (#50062)
joeblubaugh Jun 2, 2022
4231fe8
Alerting: add mute timings provenance to config api (#50149)
JohnnyQQQQ Jun 3, 2022
edf219d
Alerting: remove feature toggle for provisioning API (#50167)
JohnnyQQQQ Jun 5, 2022
d872230
Alerting: Logs should not be capitalized and the errors key should be…
gotjosh Jun 7, 2022
6fa26cb
Optional custom title and description for OpsGenie (#50131)
santihernandezc Jun 8, 2022
45ee070
Alerting: Fix image embed in email template. (#50370)
joeblubaugh Jun 9, 2022
cd052cb
Chore: Remove global bus variable (#50765)
zserge Jun 14, 2022
d46d229
Alerting: Add support for images in SensuGo alerts (#50718)
grobinson-grafana Jun 15, 2022
03e511d
Chore: Make test tracer noop and return no errors (#50797)
zserge Jun 15, 2022
33917df
Alerting: Update test funcs for notifications (#51013)
grobinson-grafana Jun 20, 2022
f4d2ce3
Alerting: Add ErrImagesDone to return from withStoredImages (#51098)
grobinson-grafana Jun 20, 2022
ca8ca94
Alerting: Support up to N fake images (#51111)
grobinson-grafana Jun 20, 2022
3e23960
Alerting: Use ErrImagesDone in Discord and SensuGo (#51106)
grobinson-grafana Jun 20, 2022
ef067c9
Alerting: Add support for images in Threema alerts (#50734)
grobinson-grafana Jun 20, 2022
3df6917
Alerting: Add support for image annotation in Alertmanager alerts (#5…
grobinson-grafana Jun 21, 2022
0c638b2
Alerting: Add support for images in VictorOps alerts (#50759)
grobinson-grafana Jun 22, 2022
7d10594
Alerting: Add support for images in Kafka alerts (#50758)
grobinson-grafana Jun 22, 2022
8038b23
KVStore: Extend kvstore to retrieve all items (#50848)
spinillos Jun 23, 2022
a5b9568
Alerting: Remove fmt.Println from Threema (#51380)
grobinson-grafana Jun 24, 2022
124830e
Alerting: Add support for images in Telegram (#51433)
grobinson-grafana Jun 28, 2022
c9827f6
Alerting: Add support for images in Pushover alerts (#51372)
grobinson-grafana Jun 28, 2022
c19ad84
Alerting: Remove withStoredImage and change forEachFunc (#51384)
grobinson-grafana Jun 30, 2022
eae8182
Alerting: Change __alertScreenshotToken__ to __alertImageToken__ (#50…
grobinson-grafana Jul 4, 2022
10ec318
Alerting: Add custom templated title to Wecom notifier (#51529)
dingweiqings Jul 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Render new email template and fix the title (#32314)
* 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>
  • Loading branch information
codesome authored and gotjosh committed Jul 14, 2022
commit 38e94357bfbdad99c41d7050f7854e81c18d3752
21 changes: 18 additions & 3 deletions alerting/channels/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package channels

import (
"context"
"fmt"
"net/url"
"strings"

gokit_log "github.com/go-kit/kit/log"
"github.com/grafana/grafana/pkg/infra/log"
Expand Down Expand Up @@ -66,12 +68,13 @@ func (en *EmailNotifier) Notify(ctx context.Context, as ...*types.Alert) (bool,
// We only need ExternalURL from this template object. This hack should go away with https://github.com/prometheus/alertmanager/pull/2508.
data := notify.GetTemplateData(ctx, &template.Template{ExternalURL: en.externalUrl}, as, gokit_log.NewNopLogger())

title := getTitleFromTemplateData(data)

cmd := &models.SendEmailCommandSync{
SendEmailCommand: models.SendEmailCommand{
Subject: "TODO",
Subject: title,
Data: map[string]interface{}{
"Title": "TODO",
"Subject": "TODO",
"Title": title,
"Receiver": data.Receiver,
"Status": data.Status,
"Alerts": data.Alerts,
Expand All @@ -95,6 +98,18 @@ func (en *EmailNotifier) Notify(ctx context.Context, as ...*types.Alert) (bool,
return true, nil
}

func getTitleFromTemplateData(data *template.Data) string {
title := "[" + data.Status
if data.Status == string(model.AlertFiring) {
title += fmt.Sprintf(":%d", len(data.Alerts.Firing()))
}
title += "]" + strings.Join(data.GroupLabels.SortedPairs().Values(), " ") + " "
if len(data.CommonLabels) > len(data.GroupLabels) {
title += "(" + strings.Join(data.CommonLabels.Remove(data.GroupLabels.Names()).Values(), " ") + ")"
}
return title
}

func (en *EmailNotifier) SendResolved() bool {
// TODO: implement this.
return true
Expand Down