kcli: *summary: use thousands separators for numeric output

Especially with provider-summary, the numbers can be very large
and adding the thousands separators makes them easier for humans
to parse.
This commit is contained in:
Wez Furlong
2024-09-13 08:52:54 -07:00
parent a90445a921
commit aecb0d9713
2 changed files with 17 additions and 15 deletions
+11 -10
View File
@@ -6,6 +6,7 @@ use futures_util::stream::FuturesUnordered;
use futures_util::StreamExt;
use lexicmp::natural_lexical_cmp;
use message::message::QueueNameComponents;
use num_format::{Locale, ToFormattedString};
use reqwest::Url;
use std::cmp::Ordering;
use std::collections::HashMap;
@@ -275,11 +276,11 @@ impl ProviderSummaryCommand {
let mut row = vec![
m.name.to_string(),
m.pool.as_ref().unwrap().to_string(),
m.delivered.to_string(),
m.transfail.to_string(),
m.fail.to_string(),
m.queue_size.to_string(),
m.connections.to_string(),
m.delivered.to_formatted_string(&Locale::en),
m.transfail.to_formatted_string(&Locale::en),
m.fail.to_formatted_string(&Locale::en),
m.queue_size.to_formatted_string(&Locale::en),
m.connections.to_formatted_string(&Locale::en),
];
if let Some(domains) = resolve_domains(&mut site_to_domains, &m.name) {
@@ -341,11 +342,11 @@ impl ProviderSummaryCommand {
}
let mut row = vec![
m.name.to_string(),
m.delivered.to_string(),
m.transfail.to_string(),
m.fail.to_string(),
m.queue_size.to_string(),
m.connections.to_string(),
m.delivered.to_formatted_string(&Locale::en),
m.transfail.to_formatted_string(&Locale::en),
m.fail.to_formatted_string(&Locale::en),
m.queue_size.to_formatted_string(&Locale::en),
m.connections.to_formatted_string(&Locale::en),
];
if let Some(domains) = resolve_domains(&mut site_to_domains, &m.name) {
+6 -5
View File
@@ -5,6 +5,7 @@ use kumo_api_types::{BounceV1ListEntry, SuspendReadyQueueV1ListEntry, SuspendV1L
use kumo_prometheus::parser::Metric;
use lexicmp::natural_lexical_cmp;
use message::message::QueueNameComponents;
use num_format::{Locale, ToFormattedString};
use reqwest::Url;
use std::cmp::Ordering;
use std::collections::HashMap;
@@ -376,10 +377,10 @@ impl QueueSummaryCommand {
m.site_name().to_string(),
m.source().unwrap_or("").to_string(),
m.protocol().unwrap_or("").to_string(),
m.delivered.to_string(),
m.transfail.to_string(),
m.connection_count.to_string(),
m.queue_size.to_string(),
m.delivered.to_formatted_string(&Locale::en),
m.transfail.to_formatted_string(&Locale::en),
m.connection_count.to_formatted_string(&Locale::en),
m.queue_size.to_formatted_string(&Locale::en),
status.to_string(),
]);
}
@@ -421,7 +422,7 @@ impl QueueSummaryCommand {
sched_rows.push(vec![
m.name.to_string(),
m.queue_size.to_string(),
m.queue_size.to_formatted_string(&Locale::en),
status.to_string(),
]);
}