From ead0373ef39d9ad1e6f7924546e7a58f2b2e8360 Mon Sep 17 00:00:00 2001 From: scydas Date: Thu, 19 Dec 2024 14:49:21 +0800 Subject: [PATCH] internalstorage: change the prefix of the db stats metrics Signed-off-by: scyda --- pkg/storage/internalstorage/metrics.go | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pkg/storage/internalstorage/metrics.go b/pkg/storage/internalstorage/metrics.go index afecf023a..8d40279d0 100644 --- a/pkg/storage/internalstorage/metrics.go +++ b/pkg/storage/internalstorage/metrics.go @@ -103,47 +103,56 @@ type DBStats struct { func newStats(labels map[string]string) *DBStats { stats := &DBStats{ MaxOpenConnections: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_max_open_connections", + Subsystem: "storage", + Name: "dbstats_max_open_connections", Help: "Maximum number of open connections to the database.", ConstLabels: labels, }), OpenConnections: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_open_connections", + Subsystem: "storage", + Name: "dbstats_open_connections", Help: "The number of established connections both in use and idle.", ConstLabels: labels, }), InUse: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_in_use", + Subsystem: "storage", + Name: "dbstats_in_use", Help: "The number of connections currently in use.", ConstLabels: labels, }), Idle: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_idle", + Subsystem: "storage", + Name: "dbstats_idle", Help: "The number of idle connections.", ConstLabels: labels, }), WaitCount: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_wait_count", + Subsystem: "storage", + Name: "dbstats_wait_count", Help: "The total number of connections waited for.", ConstLabels: labels, }), WaitDuration: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_wait_duration", + Subsystem: "storage", + Name: "dbstats_wait_duration", Help: "The total time blocked waiting for a new connection.", ConstLabels: labels, }), MaxIdleClosed: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_max_idle_closed", + Subsystem: "storage", + Name: "dbstats_max_idle_closed", Help: "The total number of connections closed due to SetMaxIdleConns.", ConstLabels: labels, }), MaxLifetimeClosed: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_max_lifetime_closed", + Subsystem: "storage", + Name: "dbstats_max_lifetime_closed", Help: "The total number of connections closed due to SetConnMaxLifetime.", ConstLabels: labels, }), MaxIdleTimeClosed: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "gorm_dbstats_max_idletime_closed", + Subsystem: "storage", + Name: "dbstats_max_idletime_closed", Help: "The total number of connections closed due to SetConnMaxIdleTime.", ConstLabels: labels, }),