| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package pgbouncer |
| 4 | |
| 5 | type metrics struct { |
| 6 | dbs map[string]*dbMetrics |
| 7 | } |
| 8 | |
| 9 | // dbMetrics represents PgBouncer database (not the PostgreSQL database of the outgoing connection). |
| 10 | type dbMetrics struct { |
| 11 | name string |
| 12 | pgDBName string |
| 13 | |
| 14 | updated bool |
| 15 | hasCharts bool |
| 16 | |
| 17 | // command 'SHOW DATABASES;' |
| 18 | maxConnections int64 |
| 19 | currentConnections int64 |
| 20 | paused int64 |
| 21 | disabled int64 |
| 22 | |
| 23 | // command 'SHOW STATS;' |
| 24 | // https://github.com/pgbouncer/pgbouncer/blob/9a346b0e451d842d7202abc3eccf0ff5a66b2dd6/src/stats.c#L76 |
| 25 | totalXactCount int64 // v1.8+ |
| 26 | totalQueryCount int64 // v1.8+ |
| 27 | totalReceived int64 |
| 28 | totalSent int64 |
| 29 | totalXactTime int64 // v1.8+ |
| 30 | totalQueryTime int64 |
| 31 | totalWaitTime int64 // v1.8+ |
| 32 | avgXactTime int64 // v1.8+ |
| 33 | avgQueryTime int64 |
| 34 | |
| 35 | // command 'SHOW POOLS;' |
| 36 | // https://github.com/pgbouncer/pgbouncer/blob/9a346b0e451d842d7202abc3eccf0ff5a66b2dd6/src/admin.c#L804 |
| 37 | clActive int64 |
| 38 | clWaiting int64 |
| 39 | clCancelReq int64 |
| 40 | svActive int64 |
| 41 | svIdle int64 |
| 42 | svUsed int64 |
| 43 | svTested int64 |
| 44 | svLogin int64 |
| 45 | maxWait int64 |
| 46 | maxWaitUS int64 // v1.8+ |
| 47 | } |