Register the collector
This commit is contained in:
parent
7c4e01e5c4
commit
685fecb033
|
@ -6,6 +6,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"github.com/matrix-org/dendrite/setup/config"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/collectors"
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
@ -48,6 +49,7 @@ func Open(dbProperties *config.DatabaseOptions, writer Writer) (*sql.DB, error)
|
||||||
db.SetMaxIdleConns(dbProperties.MaxIdleConns())
|
db.SetMaxIdleConns(dbProperties.MaxIdleConns())
|
||||||
db.SetConnMaxLifetime(dbProperties.ConnMaxLifetime())
|
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
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue