Skip to content

Commit 499612d

Browse files
authored
Add user to SHOW STATS query (#108)
* Add user to SHOW STATS query * user_name => username
1 parent 5ac85ea commit 499612d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/admin.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ where
370370
{
371371
let columns = vec![
372372
("database", DataType::Text),
373+
("user", DataType::Text),
373374
("total_xact_count", DataType::Numeric),
374375
("total_query_count", DataType::Numeric),
375376
("total_received", DataType::Numeric),
@@ -390,7 +391,7 @@ where
390391
let mut res = BytesMut::new();
391392
res.put(row_description(&columns));
392393

393-
for (_, pool) in get_all_pools() {
394+
for ((_db_name, username), pool) in get_all_pools() {
394395
for shard in 0..pool.shards() {
395396
for server in 0..pool.servers(shard) {
396397
let address = pool.address(shard, server);
@@ -400,8 +401,9 @@ where
400401
};
401402

402403
let mut row = vec![address.name()];
404+
row.push(username.clone());
403405

404-
for column in &columns[1..] {
406+
for column in &columns[2..] {
405407
row.push(stats.get(column.0).unwrap_or(&0).to_string());
406408
}
407409

0 commit comments

Comments
 (0)