summaryrefslogtreecommitdiffstats
path: root/src/go/plugin/go.d/modules/pgbouncer/metrics.go
blob: eaac52771973e899ab3fd433d1910f20728d9ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-3.0-or-later

package pgbouncer

type metrics struct {
	dbs map[string]*dbMetrics
}

// dbMetrics represents PgBouncer database (not the PostgreSQL database of the outgoing connection).
type dbMetrics struct {
	name     string
	pgDBName string

	updated   bool
	hasCharts bool

	// command 'SHOW DATABASES;'
	maxConnections     int64
	currentConnections int64
	paused             int64
	disabled           int64

	// command 'SHOW STATS;'
	// https://github.com/pgbouncer/pgbouncer/blob/9a346b0e451d842d7202abc3eccf0ff5a66b2dd6/src/stats.c#L76
	totalXactCount  int64 // v1.8+
	totalQueryCount int64 // v1.8+
	totalReceived   int64
	totalSent       int64
	totalXactTime   int64 // v1.8+
	totalQueryTime  int64
	totalWaitTime   int64 // v1.8+
	avgXactTime     int64 // v1.8+
	avgQueryTime    int64

	// command 'SHOW POOLS;'
	// https://github.com/pgbouncer/pgbouncer/blob/9a346b0e451d842d7202abc3eccf0ff5a66b2dd6/src/admin.c#L804
	clActive    int64
	clWaiting   int64
	clCancelReq int64
	svActive    int64
	svIdle      int64
	svUsed      int64
	svTested    int64
	svLogin     int64
	maxWait     int64
	maxWaitUS   int64 // v1.8+
}