metrics

package
v1.1.11-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterGormMetrics

func RegisterGormMetrics(db *gorm.DB, appConfig *config.Config) error

Types

type DBStats

type DBStats struct {
	MaxOpenConnections prometheus.Gauge // Maximum number of open connections to the database.

	// Pool status
	OpenConnections prometheus.Gauge // The number of established connections both in use and idle.
	InUse           prometheus.Gauge // The number of connections currently in use.
	Idle            prometheus.Gauge // The number of idle connections.

	// Counters
	WaitCount         prometheus.Gauge // The total number of connections waited for.
	WaitDuration      prometheus.Gauge // The total time blocked waiting for a new connection.
	MaxIdleClosed     prometheus.Gauge // The total number of connections closed due to SetMaxIdleConns.
	MaxLifetimeClosed prometheus.Gauge // The total number of connections closed due to SetConnMaxLifetime.
}

func (*DBStats) Collectors

func (stats *DBStats) Collectors() (collector []prometheus.Collector)

get collector in stats

func (*DBStats) Set

func (stats *DBStats) Set(dbStats sql.DBStats)

type Gormmetrics

type Gormmetrics struct {
	*gorm.DB
	*DBStats

	Labels map[string]string

	Config *config.Config
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL