1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-07-31 20:44:25 +03:00

Fix up collector registration (#812)

Use const definitions to make collector registration consistent.
* Use collector subsystem name consistently.
* Fix up replication metric name unit.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
Ben Kochie
2023-06-13 17:28:11 +02:00
committed by GitHub
parent 3e585c4061
commit 99828de70a
11 changed files with 65 additions and 29 deletions

View File

@ -21,8 +21,10 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const databaseSubsystem = "database"
func init() {
registerCollector("database", defaultEnabled, NewPGDatabaseCollector)
registerCollector(databaseSubsystem, defaultEnabled, NewPGDatabaseCollector)
}
type PGDatabaseCollector struct {
@ -43,7 +45,11 @@ func NewPGDatabaseCollector(config collectorConfig) (Collector, error) {
var (
pgDatabaseSizeDesc = prometheus.NewDesc(
"pg_database_size_bytes",
prometheus.BuildFQName(
namespace,
databaseSubsystem,
"size_bytes",
),
"Disk space used by the database",
[]string{"datname"}, nil,
)