Fix maxwait metric (#183)

Max wait was being reported as 0 after #159

This PR fixes that and adds test
This commit is contained in:
Mostafa Abdelraouf
2022-10-05 21:41:09 -05:00
committed by GitHub
parent 7987c5ffad
commit 3d33ccf4b0
4 changed files with 55 additions and 23 deletions

View File

@@ -228,7 +228,13 @@ where
pool_config.pool_mode.to_string(),
];
for column in &columns[3..columns.len()] {
let value = pool_stats.get(column.0).unwrap_or(&0).to_string();
let value = match column.0 {
"maxwait" => (pool_stats.get("maxwait_us").unwrap_or(&0) / 1_000_000).to_string(),
"maxwait_us" => {
(pool_stats.get("maxwait_us").unwrap_or(&0) % 1_000_000).to_string()
}
_other_values => pool_stats.get(column.0).unwrap_or(&0).to_string(),
};
row.push(value);
}
res.put(data_row(&row));