Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internalstorage: change the prefix of the db stats metrics #713

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading