Skip to content

Commit aab36b1

Browse files
author
Andrew Jackson
committed
fix pgbouncer_stats_totals_server_assignments_total metric
Signed-off-by: Andrew Jackson <[email protected]>
1 parent 766ca7e commit aab36b1

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

collector.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ var (
4545
"disabled": {GAUGE, "disabled", 1, "1 if this database is currently disabled, else 0"},
4646
},
4747
"stats_totals": {
48-
"database": {LABEL, "N/A", 1, "N/A"},
49-
"query_count": {COUNTER, "queries_pooled_total", 1, "Total number of SQL queries pooled"},
50-
"query_time": {COUNTER, "queries_duration_seconds_total", 1e-6, "Total number of seconds spent by pgbouncer when actively connected to PostgreSQL, executing queries"},
51-
"bytes_received": {COUNTER, "received_bytes_total", 1, "Total volume in bytes of network traffic received by pgbouncer, shown as bytes"},
52-
"requests": {COUNTER, "queries_total", 1, "Total number of SQL requests pooled by pgbouncer, shown as requests"},
53-
"bytes_sent": {COUNTER, "sent_bytes_total", 1, "Total volume in bytes of network traffic sent by pgbouncer, shown as bytes"},
54-
"wait_time": {COUNTER, "client_wait_seconds_total", 1e-6, "Time spent by clients waiting for a server in seconds"},
55-
"xact_count": {COUNTER, "sql_transactions_pooled_total", 1, "Total number of SQL transactions pooled"},
56-
"xact_time": {COUNTER, "server_in_transaction_seconds_total", 1e-6, "Total number of seconds spent by pgbouncer when connected to PostgreSQL in a transaction, either idle in transaction or executing queries"},
57-
"client_parse_count": {COUNTER, "client_parses_total", 1, "Total number of prepared statement Parse messages received from clients"},
58-
"server_parse_count": {COUNTER, "server_parses_total", 1, "Total number of prepared statement Parse messages sent by pgbouncer to PostgreSQL"},
59-
"bind_count": {COUNTER, "binds_total", 1, "Total number of prepared statements readied for execution with a Bind message"},
60-
"total_server_assignment_count": {COUNTER, "server_assignments_total", 1, "Total number of client connections which have been served since process start"},
48+
"database": {LABEL, "N/A", 1, "N/A"},
49+
"query_count": {COUNTER, "queries_pooled_total", 1, "Total number of SQL queries pooled"},
50+
"query_time": {COUNTER, "queries_duration_seconds_total", 1e-6, "Total number of seconds spent by pgbouncer when actively connected to PostgreSQL, executing queries"},
51+
"bytes_received": {COUNTER, "received_bytes_total", 1, "Total volume in bytes of network traffic received by pgbouncer, shown as bytes"},
52+
"requests": {COUNTER, "queries_total", 1, "Total number of SQL requests pooled by pgbouncer, shown as requests"},
53+
"bytes_sent": {COUNTER, "sent_bytes_total", 1, "Total volume in bytes of network traffic sent by pgbouncer, shown as bytes"},
54+
"wait_time": {COUNTER, "client_wait_seconds_total", 1e-6, "Time spent by clients waiting for a server in seconds"},
55+
"xact_count": {COUNTER, "sql_transactions_pooled_total", 1, "Total number of SQL transactions pooled"},
56+
"xact_time": {COUNTER, "server_in_transaction_seconds_total", 1e-6, "Total number of seconds spent by pgbouncer when connected to PostgreSQL in a transaction, either idle in transaction or executing queries"},
57+
"client_parse_count": {COUNTER, "client_parses_total", 1, "Total number of prepared statement Parse messages received from clients"},
58+
"server_parse_count": {COUNTER, "server_parses_total", 1, "Total number of prepared statement Parse messages sent by pgbouncer to PostgreSQL"},
59+
"bind_count": {COUNTER, "binds_total", 1, "Total number of prepared statements readied for execution with a Bind message"},
60+
"server_assignment_count": {COUNTER, "server_assignments_total", 1, "Total number of client connections which have been served since process start"},
6161
},
6262
"pools": {
6363
"database": {LABEL, "N/A", 1, "N/A"},

collector_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func TestQueryShowStats(t *testing.T) {
151151

152152
// expected metrics are returned in the same order as the colums
153153
expected := []MetricResult{
154+
{labels: labelMap{"database": "pg0"}, metricType: dto.MetricType_COUNTER, value: -1}, // server_assignment_count
154155
{labels: labelMap{"database": "pg0"}, metricType: dto.MetricType_COUNTER, value: 10}, // xact_count
155156
{labels: labelMap{"database": "pg0"}, metricType: dto.MetricType_COUNTER, value: 40}, // query_count
156157
{labels: labelMap{"database": "pg0"}, metricType: dto.MetricType_COUNTER, value: 220}, // bytes_received

0 commit comments

Comments
 (0)