From 685fecb033c09fda075290a44afac6cd95b3b866 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 4 Oct 2022 13:37:32 +0100 Subject: [PATCH] Register the collector --- internal/sqlutil/sqlutil.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/sqlutil/sqlutil.go b/internal/sqlutil/sqlutil.go index ade4d4270..fa6e200ea 100644 --- a/internal/sqlutil/sqlutil.go +++ b/internal/sqlutil/sqlutil.go @@ -6,6 +6,7 @@ import ( "regexp" "github.com/matrix-org/dendrite/setup/config" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" "github.com/sirupsen/logrus" ) @@ -48,6 +49,7 @@ func Open(dbProperties *config.DatabaseOptions, writer Writer) (*sql.DB, error) db.SetMaxIdleConns(dbProperties.MaxIdleConns()) db.SetConnMaxLifetime(dbProperties.ConnMaxLifetime()) } - collectors.NewDBStatsCollector(db, fmt.Sprintf("dendrite_%s", dbProperties.Name)) + collector := collectors.NewDBStatsCollector(db, fmt.Sprintf("dendrite_%s", dbProperties.Name)) + prometheus.MustRegister(collector) return db, nil }