Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(console): remove histogram minimum count #424

Merged
merged 1 commit into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 0 additions & 15 deletions tokio-console/src/view/mini_histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ pub(crate) struct HistogramMetadata {
pub(crate) min_value: u64,
/// The value of the bucket with the greatest quantity
pub(crate) max_bucket: u64,
/// The value of the bucket with the smallest quantity
pub(crate) min_bucket: u64,
/// Number of high outliers, if any
pub(crate) high_outliers: u64,
pub(crate) highest_outlier: Option<Duration>,
Expand Down Expand Up @@ -87,7 +85,6 @@ impl<'a> Widget for MiniHistogram<'a> {
};

let max_qty_label = metadata.max_bucket.to_string();
let min_qty_label = metadata.min_bucket.to_string();
let max_record_label = format!(
"{:.prec$?}",
Duration::from_nanos(metadata.max_value),
Expand All @@ -107,7 +104,6 @@ impl<'a> Widget for MiniHistogram<'a> {
max_record_label,
min_record_label,
max_qty_label,
min_qty_label,
);

let legend_height = if metadata.high_outliers > 0 { 2 } else { 1 };
Expand Down Expand Up @@ -229,7 +225,6 @@ fn render_legend(
max_record_label: String,
min_record_label: String,
max_qty_label: String,
min_qty_label: String,
) {
// If there are outliers, display a note
let labels_pos = if metadata.high_outliers > 0 {
Expand All @@ -253,14 +248,6 @@ fn render_legend(

// top left: max quantity
buf.set_string(area.left(), area.top(), &max_qty_label, Style::default());
// bottom left: 0 aligned to right
let zero_label = format!("{:>width$}", &min_qty_label, width = max_qty_label.len());
buf.set_string(
area.left(),
area.bottom() - labels_pos,
&zero_label,
Style::default(),
);
// bottom left below the chart: min time
buf.set_string(
area.left() + max_qty_label.len() as u16,
Expand Down Expand Up @@ -311,14 +298,12 @@ fn chart_data(histogram: &DurationHistogram, width: u16) -> (Vec<u64>, Histogram
Vec::new()
};
let max_bucket = data.iter().max().copied().unwrap_or_default();
let min_bucket = data.iter().min().copied().unwrap_or_default();
(
data,
HistogramMetadata {
max_value: histogram.max(),
min_value: histogram.min(),
max_bucket,
min_bucket,
high_outliers,
highest_outlier,
},
Expand Down