mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-27 18:56:30 +00:00
Add user to SHOW STATS query (#108)
* Add user to SHOW STATS query * user_name => username
This commit is contained in:
committed by
GitHub
parent
5ac85eaadd
commit
499612dd76
@@ -370,6 +370,7 @@ where
|
|||||||
{
|
{
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("database", DataType::Text),
|
("database", DataType::Text),
|
||||||
|
("user", DataType::Text),
|
||||||
("total_xact_count", DataType::Numeric),
|
("total_xact_count", DataType::Numeric),
|
||||||
("total_query_count", DataType::Numeric),
|
("total_query_count", DataType::Numeric),
|
||||||
("total_received", DataType::Numeric),
|
("total_received", DataType::Numeric),
|
||||||
@@ -390,7 +391,7 @@ where
|
|||||||
let mut res = BytesMut::new();
|
let mut res = BytesMut::new();
|
||||||
res.put(row_description(&columns));
|
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 shard in 0..pool.shards() {
|
||||||
for server in 0..pool.servers(shard) {
|
for server in 0..pool.servers(shard) {
|
||||||
let address = pool.address(shard, server);
|
let address = pool.address(shard, server);
|
||||||
@@ -400,8 +401,9 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut row = vec![address.name()];
|
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());
|
row.push(stats.get(column.0).unwrap_or(&0).to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user