Skip to content

Commit

Permalink
internalstorage: change the prefix of the db stats metrics
Browse files Browse the repository at this point in the history
Signed-off-by: scyda <scyda@outlook.com>
  • Loading branch information
scydas committed Dec 19, 2024
1 parent f730e26 commit ead0373
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions pkg/storage/internalstorage/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
Expand Down

0 comments on commit ead0373

Please sign in to comment.