@@ -144,22 +144,23 @@ func TestQueryShowDatabases(t *testing.T) {
144
144
func TestQueryShowStats (t * testing.T ) {
145
145
// columns are listed in the order PgBouncers exposes them, a value of -1 means pgbouncer_exporter does not expose this value as a metric
146
146
rows := sqlmock .NewRows ([]string {"database" ,
147
- "total_xact_count" , "total_query_count" , "total_server_assignment_count" , "total_received" , "total_sent" ,
148
- "total_xact_time" , "total_query_time" , "total_wait_time" , "total_client_parse_count" , "total_server_parse_count" , "total_bind_count" }).
149
- AddRow ("pg0" , 10 , 40 , - 1 , 220 , 460 , 6 , 8 , 9 , 5 , 55 , 555 )
147
+ "server_assignment_count" ,
148
+ "xact_count" , "query_count" , "bytes_received" , "bytes_sent" ,
149
+ "xact_time" , "query_time" , "wait_time" , "client_parse_count" , "server_parse_count" , "bind_count" }).
150
+ AddRow ("pg0" , - 1 , 10 , 40 , 220 , 460 , 6 , 8 , 9 , 5 , 55 , 555 )
150
151
151
152
// expected metrics are returned in the same order as the colums
152
153
expected := []MetricResult {
153
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 10 }, // total_xact_count
154
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 40 }, // total_query_count
155
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 220 }, // total_received
156
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 460 }, // total_sent
157
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 6e-6 }, // total_xact_time
158
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 8e-6 }, // total_query_time
159
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 9e-6 }, // total_wait_time
160
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 5 }, // total_client_parse_count
161
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 55 }, // total_server_parse_count
162
- {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 555 }, // total_bind_count
154
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 10 }, // xact_count
155
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 40 }, // query_count
156
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 220 }, // bytes_received
157
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 460 }, // bytes_sent
158
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 6e-6 }, // xact_time
159
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 8e-6 }, // query_time
160
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 9e-6 }, // wait_time
161
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 5 }, // client_parse_count
162
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 55 }, // server_parse_count
163
+ {labels : labelMap {"database" : "pg0" }, metricType : dto .MetricType_COUNTER , value : 555 }, // bind_count
163
164
}
164
165
165
166
testQueryNamespaceMapping (t , "stats_totals" , rows , expected )
0 commit comments