mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-10-02 19:41:57 +00:00
feat(dbmanager): report pool max size and total connections opened
Add MaxOpenConnections to provider and connection stats, exposed as the max state of dbmanager_connection_pool_size. Count physical dials through a counting driver connector and export dbmanager_connections_opened_total; existing_db pools derive an approximate count from sql.DBStats.
This commit is contained in:
@@ -55,13 +55,15 @@ type ConnectionStats struct {
|
||||
HealthCheckStatus string
|
||||
|
||||
// SQL connection pool stats
|
||||
OpenConnections int
|
||||
InUse int
|
||||
Idle int
|
||||
WaitCount int64
|
||||
WaitDuration time.Duration
|
||||
MaxIdleClosed int64
|
||||
MaxLifetimeClosed int64
|
||||
OpenConnections int
|
||||
MaxOpenConnections int
|
||||
TotalOpened int64 // physical connections ever opened
|
||||
InUse int
|
||||
Idle int
|
||||
WaitCount int64
|
||||
WaitDuration time.Duration
|
||||
MaxIdleClosed int64
|
||||
MaxLifetimeClosed int64
|
||||
}
|
||||
|
||||
// sqlConnection implements Connection for SQL databases (PostgreSQL, SQLite, MSSQL)
|
||||
@@ -415,6 +417,8 @@ func (c *sqlConnection) Stats() *ConnectionStats {
|
||||
if c.connected && c.provider != nil {
|
||||
if providerStats := c.provider.Stats(); providerStats != nil {
|
||||
stats.OpenConnections = providerStats.OpenConnections
|
||||
stats.MaxOpenConnections = providerStats.MaxOpenConnections
|
||||
stats.TotalOpened = providerStats.TotalOpened
|
||||
stats.InUse = providerStats.InUse
|
||||
stats.Idle = providerStats.Idle
|
||||
stats.WaitCount = providerStats.WaitCount
|
||||
|
||||
Reference in New Issue
Block a user