Skip to content

Commit 852129e

Browse files
committed
Addind AlertManager SNS Receiver Implementation
Signed-off-by: Alan Protasio <[email protected]>
1 parent e658571 commit 852129e

File tree

23 files changed

+9603
-10
lines changed

23 files changed

+9603
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- `-memberlist.dead-node-reclaim-time`
1313
* [FEATURE] Ruler: Add new `-ruler.query-stats-enabled` which when enabled will report the `cortex_ruler_query_seconds_total` as a per-user metric that tracks the sum of the wall time of executing queries in the ruler in seconds. #4317
1414
* [FEATURE] Query Frontend: Add `cortex_query_fetched_series_total` and `cortex_query_fetched_chunks_bytes_total` per-user counters to expose the number of series and bytes fetched as part of queries. These metrics can be enabled with the `-frontend.query-stats-enabled` flag (or its respective YAML config option `query_stats_enabled`). #4343
15+
* [FEATURE] AlertManager: Add support for SNS Receiver. #4382
1516
* [CHANGE] Update Go version to 1.16.6. #4362
1617
* [CHANGE] Querier / ruler: Change `-querier.max-fetched-chunks-per-query` configuration to limit to maximum number of chunks that can be fetched in a single query. The number of chunks fetched by ingesters AND long-term storare combined should not exceed the value configured on `-querier.max-fetched-chunks-per-query`. #4260
1718
* [CHANGE] Memberlist: the `memberlist_kv_store_value_bytes` has been removed due to values no longer being stored in-memory as encoded bytes. #4345

docs/configuration/config-file-reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4177,7 +4177,7 @@ The `limits_config` configures default and per-tenant limits imposed by Cortex s
41774177
# is given in JSON format. Rate limit has the same meaning as
41784178
# -alertmanager.notification-rate-limit, but only applies for specific
41794179
# integration. Allowed integration names: webhook, email, pagerduty, opsgenie,
4180-
# wechat, slack, victorops, pushover.
4180+
# wechat, slack, victorops, pushover, sns.
41814181
# CLI flag: -alertmanager.notification-rate-limit-per-integration
41824182
[alertmanager_notification_rate_limit_per_integration: <map of string to float64> | default = {}]
41834183

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/opentracing-contrib/go-stdlib v1.0.0
4646
github.com/opentracing/opentracing-go v1.2.0
4747
github.com/pkg/errors v0.9.1
48-
github.com/prometheus/alertmanager v0.22.3-0.20210628111558-8491f816296b
48+
github.com/prometheus/alertmanager v0.22.3-0.20210726110322-3d86bd709df8
4949
github.com/prometheus/client_golang v1.11.0
5050
github.com/prometheus/client_model v0.2.0
5151
github.com/prometheus/common v0.29.0

go.sum

+4-3
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,8 @@ github.com/prometheus/alertmanager v0.21.1-0.20201106142418-c39b78780054/go.mod
14551455
github.com/prometheus/alertmanager v0.21.1-0.20210310093010-0f9cab6991e6/go.mod h1:MTqVn+vIupE0dzdgo+sMcNCp37SCAi8vPrvKTTnTz9g=
14561456
github.com/prometheus/alertmanager v0.21.1-0.20210422101724-8176f78a70e1/go.mod h1:gsEqwD5BHHW9RNKvCuPOrrTMiP5I+faJUyLXvnivHik=
14571457
github.com/prometheus/alertmanager v0.22.2/go.mod h1:rYinOWxFuCnNssc3iOjn2oMTlhLaPcUuqV5yk5JKUAE=
1458-
github.com/prometheus/alertmanager v0.22.3-0.20210628111558-8491f816296b h1:Ug/6s8FVHfsuSGFNUTAhvp3ZXkeAVk2TvHeolesN/wk=
1459-
github.com/prometheus/alertmanager v0.22.3-0.20210628111558-8491f816296b/go.mod h1:ntrorfzWQ1I9mhJK7AO71w4xMUgM4SxmwbtyQgAWZz0=
1458+
github.com/prometheus/alertmanager v0.22.3-0.20210726110322-3d86bd709df8 h1:EH5EZxZcmazowe8c86MnhO77Kn/7ni9C5SdmdDK38UE=
1459+
github.com/prometheus/alertmanager v0.22.3-0.20210726110322-3d86bd709df8/go.mod h1:BBhEP06PwDGsIKsQzOeTNe2jU6tU19SzhJ41C2ib4XE=
14601460
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
14611461
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
14621462
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -1508,10 +1508,11 @@ github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16
15081508
github.com/prometheus/common v0.20.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
15091509
github.com/prometheus/common v0.21.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
15101510
github.com/prometheus/common v0.23.0/go.mod h1:H6QK/N6XVT42whUeIdI3dp36w49c+/iMDk7UAI2qm7Q=
1511-
github.com/prometheus/common v0.24.0/go.mod h1:H6QK/N6XVT42whUeIdI3dp36w49c+/iMDk7UAI2qm7Q=
15121511
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
15131512
github.com/prometheus/common v0.29.0 h1:3jqPBvKT4OHAbje2Ql7KeaaSicDBCxMYwEJU1zRJceE=
15141513
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
1514+
github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4=
1515+
github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI=
15151516
github.com/prometheus/exporter-toolkit v0.5.0/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg=
15161517
github.com/prometheus/exporter-toolkit v0.5.1/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg=
15171518
github.com/prometheus/exporter-toolkit v0.6.0 h1:rGoS9gIqj3sXaw+frvo0ozCs1CxBRqpOCGsbixC52UI=

pkg/alertmanager/alertmanager.go

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/prometheus/alertmanager/notify/pagerduty"
3030
"github.com/prometheus/alertmanager/notify/pushover"
3131
"github.com/prometheus/alertmanager/notify/slack"
32+
"github.com/prometheus/alertmanager/notify/sns"
3233
"github.com/prometheus/alertmanager/notify/victorops"
3334
"github.com/prometheus/alertmanager/notify/webhook"
3435
"github.com/prometheus/alertmanager/notify/wechat"
@@ -515,6 +516,9 @@ func buildReceiverIntegrations(nc *config.Receiver, tmpl *template.Template, fir
515516
for i, c := range nc.PushoverConfigs {
516517
add("pushover", i, c, func(l log.Logger) (notify.Notifier, error) { return pushover.New(c, tmpl, l, httpOps...) })
517518
}
519+
for i, c := range nc.SNSConfigs {
520+
add("sns", i, c, func(l log.Logger) (notify.Notifier, error) { return sns.New(c, tmpl, l, httpOps...) })
521+
}
518522
// If we add support for more integrations, we need to add them to validation as well. See validation.allowedIntegrationNames field.
519523
if errs.Len() > 0 {
520524
return nil, &errs

pkg/util/validation/notifications_limit_flag.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
var allowedIntegrationNames = []string{
13-
"webhook", "email", "pagerduty", "opsgenie", "wechat", "slack", "victorops", "pushover",
13+
"webhook", "email", "pagerduty", "opsgenie", "wechat", "slack", "victorops", "pushover", "sns",
1414
}
1515

1616
type NotificationRateLimitMap map[string]float64

0 commit comments

Comments
 (0)