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 }