@@ -30,6 +30,7 @@ import (
3030 "github.com/prometheus/alertmanager/notify/email"
3131 "github.com/prometheus/alertmanager/notify/incidentio"
3232 "github.com/prometheus/alertmanager/notify/jira"
33+ "github.com/prometheus/alertmanager/notify/mattermost"
3334 "github.com/prometheus/alertmanager/notify/msteams"
3435 "github.com/prometheus/alertmanager/notify/msteamsv2"
3536 "github.com/prometheus/alertmanager/notify/opsgenie"
@@ -87,14 +88,13 @@ type Config struct {
8788 // Tenant-specific local directory where AM can store its state (notifications, silences, templates). When AM is stopped, entire dir is removed.
8889 TenantDataDir string
8990
90- ShardingEnabled bool
91- ReplicationFactor int
92- Replicator Replicator
93- Store alertstore.AlertStore
94- PersisterConfig PersisterConfig
95- APIConcurrency int
96- GCInterval time.Duration
97- DispatchStartDelay time.Duration
91+ ShardingEnabled bool
92+ ReplicationFactor int
93+ Replicator Replicator
94+ Store alertstore.AlertStore
95+ PersisterConfig PersisterConfig
96+ APIConcurrency int
97+ GCInterval time.Duration
9898}
9999
100100// An Alertmanager manages the alerts for one user.
@@ -130,6 +130,8 @@ type Alertmanager struct {
130130 configHashMetric prometheus.Gauge
131131
132132 rateLimitedNotifications * prometheus.CounterVec
133+
134+ requestDuration * prometheus.HistogramVec
133135}
134136
135137var (
@@ -184,6 +186,17 @@ func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error) {
184186 Help : "Number of rate-limited notifications per integration." ,
185187 }, []string {"integration" }), // "integration" is consistent with other alertmanager metrics.
186188
189+ requestDuration : promauto .With (reg ).NewHistogramVec (
190+ prometheus.HistogramOpts {
191+ Name : "alertmanager_http_request_duration_seconds" ,
192+ Help : "Histogram of latencies for HTTP requests." ,
193+ Buckets : prometheus .DefBuckets ,
194+ NativeHistogramBucketFactor : 1.1 ,
195+ NativeHistogramMaxBucketNumber : 100 ,
196+ NativeHistogramMinResetDuration : 1 * time .Hour ,
197+ },
198+ []string {"handler" , "method" , "code" },
199+ ),
187200 }
188201
189202 am .registry = reg
@@ -292,7 +305,8 @@ func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error) {
292305 GroupFunc : func (ctx context.Context , f1 func (* dispatch.Route ) bool , f2 func (* types.Alert , time.Time ) bool ) (dispatch.AlertGroups , map [model.Fingerprint ][]string , error ) {
293306 return am .dispatcher .Groups (ctx , f1 , f2 )
294307 },
295- Concurrency : am .cfg .APIConcurrency ,
308+ Concurrency : am .cfg .APIConcurrency ,
309+ RequestDuration : am .requestDuration ,
296310 })
297311 if err != nil {
298312 return nil , fmt .Errorf ("failed to create api: %v" , err )
@@ -612,6 +626,11 @@ func buildReceiverIntegrations(nc config.Receiver, tmpl *template.Template, fire
612626 return incidentio .New (c , tmpl , util_log .GoKitLogToSlog (l ), httpOps ... )
613627 })
614628 }
629+ for i , c := range nc .MattermostConfigs {
630+ add ("mattermost" , i , c , func (l log.Logger ) (notify.Notifier , error ) {
631+ return mattermost .New (c , tmpl , util_log .GoKitLogToSlog (l ), httpOps ... )
632+ })
633+ }
615634
616635 // If we add support for more integrations, we need to add them to validation as well. See validation.allowedIntegrationNames field.
617636 if errs .Len () > 0 {
0 commit comments