From 740c5813d43e2bc8079c7db216fa532f3f87a653 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Mon, 29 Mar 2021 20:35:15 +0530 Subject: [PATCH] AlertingNG: Fix dispatcher metrics in notifier (#32434) Signed-off-by: Ganesh Vernekar --- pkg/services/ngalert/notifier/alertmanager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/services/ngalert/notifier/alertmanager.go b/pkg/services/ngalert/notifier/alertmanager.go index 2dfbec51b94..099af3d9911 100644 --- a/pkg/services/ngalert/notifier/alertmanager.go +++ b/pkg/services/ngalert/notifier/alertmanager.go @@ -51,7 +51,8 @@ type Alertmanager struct { dispatcher *dispatch.Dispatcher dispatcherWG sync.WaitGroup - stageMetrics *notify.Metrics + stageMetrics *notify.Metrics + dispatcherMetrics *dispatch.DispatcherMetrics reloadConfigMtx sync.Mutex } @@ -69,6 +70,7 @@ func (am *Alertmanager) Init() (err error) { r := prometheus.NewRegistry() am.marker = types.NewMarker(r) am.stageMetrics = notify.NewMetrics(r) + am.dispatcherMetrics = dispatch.NewDispatcherMetrics(r) am.Store = store.DBstore{SQLStore: am.SQLStore} am.notificationLog, err = nflog.New( @@ -196,8 +198,7 @@ func (am *Alertmanager) applyConfig(cfg *api.PostableUserConfig) error { am.StopAndWait() //TODO: Verify this is correct route := dispatch.NewRoute(cfg.AlertmanagerConfig.Route, nil) - //TODO: This needs the metrics - am.dispatcher = dispatch.NewDispatcher(am.alerts, route, routingStage, am.marker, timeoutFunc, gokit_log.NewNopLogger(), nil) + am.dispatcher = dispatch.NewDispatcher(am.alerts, route, routingStage, am.marker, timeoutFunc, gokit_log.NewNopLogger(), am.dispatcherMetrics) am.dispatcherWG.Add(1) go func() {