From b8b3ddfe6319f5baa7d35b2c7ced3c7156803085 Mon Sep 17 00:00:00 2001 From: Toby Lawrence Date: Wed, 1 May 2019 10:38:20 -0400 Subject: [PATCH] Bump metrics-recorder-text to 0.2.0 --- metrics-recorder-text/Cargo.toml | 2 +- metrics-recorder-text/src/lib.rs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/metrics-recorder-text/Cargo.toml b/metrics-recorder-text/Cargo.toml index 351e3d1..9e26d30 100644 --- a/metrics-recorder-text/Cargo.toml +++ b/metrics-recorder-text/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "metrics-recorder-text" -version = "0.1.0" +version = "0.2.0" authors = ["Toby Lawrence "] edition = "2018" diff --git a/metrics-recorder-text/src/lib.rs b/metrics-recorder-text/src/lib.rs index 090e8d6..436a7f9 100644 --- a/metrics-recorder-text/src/lib.rs +++ b/metrics-recorder-text/src/lib.rs @@ -42,11 +42,11 @@ //! connect_time max: 139389 //! ``` //! -use std::collections::{HashMap, VecDeque}; -use std::fmt::Display; use hdrhistogram::Histogram; use metrics_core::Recorder; -use metrics_util::{Quantile, parse_quantiles}; +use metrics_util::{parse_quantiles, Quantile}; +use std::collections::{HashMap, VecDeque}; +use std::fmt::Display; /// Records metrics in a hierarchical, text-based format. pub struct TextRecorder { @@ -60,11 +60,15 @@ impl TextRecorder { /// Configures the recorder with these default quantiles: 0.0, 0.5, 0.9, 0.95, 0.99, 0.999, and /// 1.0. If you want to customize the quantiles used, you can call /// [`TextRecorder::with_quantiles`]. + /// + /// The configured quantiles are used when rendering any histograms. pub fn new() -> Self { Self::with_quantiles(&[0.0, 0.5, 0.9, 0.95, 0.99, 0.999, 1.0]) } /// Creates a new [`TextRecorder`] with the given set of quantiles. + /// + /// The configured quantiles are used when rendering any histograms. pub fn with_quantiles(quantiles: &[f64]) -> Self { let actual_quantiles = parse_quantiles(quantiles); @@ -249,12 +253,7 @@ fn hist_to_values(name: String, hist: Histogram, quantiles: &[Quantile]) -> values.push(format!("{} count: {}", name, hist.len())); for quantile in quantiles { let value = hist.value_at_quantile(quantile.value()); - values.push(format!( - "{} {}: {}", - name, - quantile.label(), - value, - )); + values.push(format!("{} {}: {}", name, quantile.label(), value)); } values