pub struct Rate { /* private fields */ }Expand description
The rate of the given quantity. By default this is the total observed over a
set of samples from a sampled statistic divided by the elapsed time over the
sample windows. Alternative SampledStat implementations can be provided,
however, to record the rate of occurrences (e.g. the count of values measured
over the time interval) or other such values.
Implementations§
Source§impl Rate
impl Rate
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a Rate over seconds backed by a WindowedSum.
Sourcepub fn with_unit(unit: TimeUnit) -> Self
pub fn with_unit(unit: TimeUnit) -> Self
Create a Rate with the given unit backed by a WindowedSum.
§Arguments
unit- the time unit of the rate
Sourcepub fn with_stat(stat: Arc<SampledStat>) -> Self
pub fn with_stat(stat: Arc<SampledStat>) -> Self
Create a Rate over seconds backed by the given sampled stat.
§Arguments
stat- the sampled stat whose total the rate divides
Sourcepub fn with_unit_stat(unit: TimeUnit, stat: Arc<SampledStat>) -> Self
pub fn with_unit_stat(unit: TimeUnit, stat: Arc<SampledStat>) -> Self
Create a Rate with the given unit and sampled stat.
§Arguments
unit- the time unit of the ratestat- the sampled stat whose total the rate divides
Sourcepub fn with_unit_stat_window(
unit: TimeUnit,
stat: Arc<SampledStat>,
window: i64,
) -> Self
pub fn with_unit_stat_window( unit: TimeUnit, stat: Arc<SampledStat>, window: i64, ) -> Self
Create a Rate with the given unit, sampled stat and explicit window.
§Arguments
unit- the time unit of the rate and ofwindowstat- the sampled stat whose total the rate divideswindow- when positive, the stat’s own time window, inunit
Sourcepub fn unit_name(&self) -> String
pub fn unit_name(&self) -> String
Returns the lower-cased name of the rate’s unit with the trailing “s”
stripped, e.g. SECONDS -> second.
Sourcepub fn window_size(&self, config: &MetricConfig, now: i64) -> i64
pub fn window_size(&self, config: &MetricConfig, now: i64) -> i64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rate
impl !RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnsafeUnpin for Rate
impl !UnwindSafe for Rate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<M> MetricValueProvider for Mwhere
M: Measurable,
impl<M> MetricValueProvider for Mwhere
M: Measurable,
Source§fn value(&self, config: &MetricConfig, now: i64) -> MetricValue
fn value(&self, config: &MetricConfig, now: i64) -> MetricValue
Returns the current value associated with this metric. Read more
Source§fn type_name(&self) -> Option<&'static str>
fn type_name(&self) -> Option<&'static str>
Returns the provider’s type name, as
KafkaMetric’s Display reports
it, or None for a provider that is a closure. Read more