Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* `-server.grpc.keepalive.timeout`
* [ENHANCEMENT] PostgreSQL: Bump up `github.com/lib/pq` from `v1.0.0` to `v1.3.0` to support PostgreSQL SCRAM-SHA-256 authentication. #2097
* [ENHANCEMENT] Casandra: User no longer need `CREATE` privilege on `<all keyspaces>` if given keyspace exists. #2032
* [BUGFIX] Alertmanager: fixed panic upon applying a new config, caused by duplicate metrics registration in the `NewPipelineBuilder` function. #211
* [BUGFIX] Experimental TSDB: fixed `/all_user_stats` and `/api/prom/user_stats` endpoints when using the experimental TSDB blocks storage. #2042
* [BUGFIX] Experimental TSDB: fixed ruler to correctly work with the experimental TSDB blocks storage. #2101
* [BUGFIX] Azure Blob ChunkStore: Fixed issue causing `invalid chunk checksum` errors. #2074
Expand Down
33 changes: 18 additions & 15 deletions pkg/alertmanager/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ type Config struct {

// An Alertmanager manages the alerts for one user.
type Alertmanager struct {
cfg *Config
api *api.API
logger log.Logger
nflog *nflog.Log
silences *silence.Silences
marker types.Marker
alerts *mem.Alerts
dispatcher *dispatch.Dispatcher
inhibitor *inhibit.Inhibitor
stop chan struct{}
wg sync.WaitGroup
mux *http.ServeMux
registry *prometheus.Registry
cfg *Config
api *api.API
logger log.Logger
nflog *nflog.Log
silences *silence.Silences
marker types.Marker
alerts *mem.Alerts
dispatcher *dispatch.Dispatcher
inhibitor *inhibit.Inhibitor
pipelineBuilder *notify.PipelineBuilder
stop chan struct{}
wg sync.WaitGroup
mux *http.ServeMux
registry *prometheus.Registry
}

var webReload = make(chan chan error)
Expand Down Expand Up @@ -130,6 +131,8 @@ func New(cfg *Config) (*Alertmanager, error) {
am.silences.SetBroadcast(c.Broadcast)
}

am.pipelineBuilder = notify.NewPipelineBuilder(am.registry)

am.wg.Add(1)
go func() {
am.silences.Maintenance(15*time.Minute, filepath.Join(cfg.DataDir, silencesID), am.stop)
Expand Down Expand Up @@ -205,8 +208,8 @@ func (am *Alertmanager) ApplyConfig(userID string, conf *config.Config) error {
if err != nil {
return nil
}
pipelineBuilder := notify.NewPipelineBuilder(am.registry)
pipeline := pipelineBuilder.New(

pipeline := am.pipelineBuilder.New(
integrationsMap,
waitFunc,
am.inhibitor,
Expand Down