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

@@ -20,8 +20,10 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const postmasterSubsystem = "postmaster"
func init() {
registerCollector("postmaster", defaultEnabled, NewPGPostmasterCollector)
registerCollector(postmasterSubsystem, defaultEnabled, NewPGPostmasterCollector)
}
type PGPostmasterCollector struct {
@@ -33,7 +35,11 @@ func NewPGPostmasterCollector(collectorConfig) (Collector, error) {
var (
pgPostMasterStartTimeSeconds = prometheus.NewDesc(
"pg_postmaster_start_time_seconds",
prometheus.BuildFQName(
namespace,
postmasterSubsystem,
"start_time_seconds",
),
"Time at which postmaster started",
[]string{}, nil,
)