Skip to content

Commit

Permalink
Add user to SHOW STATS query (#108)
Browse files Browse the repository at this point in the history
* Add user to SHOW STATS query

* user_name => username
  • Loading branch information
drdrsh authored Aug 4, 2022
1 parent 5ac85ea commit 499612d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ where
{
let columns = vec![
("database", DataType::Text),
("user", DataType::Text),
("total_xact_count", DataType::Numeric),
("total_query_count", DataType::Numeric),
("total_received", DataType::Numeric),
Expand All @@ -390,7 +391,7 @@ where
let mut res = BytesMut::new();
res.put(row_description(&columns));

for (_, pool) in get_all_pools() {
for ((_db_name, username), pool) in get_all_pools() {
for shard in 0..pool.shards() {
for server in 0..pool.servers(shard) {
let address = pool.address(shard, server);
Expand All @@ -400,8 +401,9 @@ where
};

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

for column in &columns[1..] {
for column in &columns[2..] {
row.push(stats.get(column.0).unwrap_or(&0).to_string());
}

Expand Down

0 comments on commit 499612d

Please sign in to comment.