pub struct SimpleRate { /* private fields */ }Expand description
A simple rate: the rate is incrementally calculated based on the elapsed time between the earliest reading and now.
An exception is made for the first window, which is considered of fixed size. This avoids the issue of an artificially high rate when the gap between readings is close to 0.
§Translation notes
Composes a Rate instead of extending it.
Implementations§
Source§impl SimpleRate
impl SimpleRate
Sourcepub fn window_size(&self, config: &MetricConfig, now: i64) -> i64
pub fn window_size(&self, config: &MetricConfig, now: i64) -> i64
Compute the window size in milliseconds, overriding Rate::window_size:
max(elapsed, config.timeWindowMs()).
§Arguments
config- the metric’s configurationnow- the current POSIX time in milliseconds
§Returns
The window size in milliseconds.
Trait Implementations§
Source§impl Debug for SimpleRate
impl Debug for SimpleRate
Source§impl Default for SimpleRate
impl Default for SimpleRate
Source§impl Display for SimpleRate
impl Display for SimpleRate
Source§impl Measurable for SimpleRate
impl Measurable for SimpleRate
Auto Trait Implementations§
impl Freeze for SimpleRate
impl !RefUnwindSafe for SimpleRate
impl Send for SimpleRate
impl Sync for SimpleRate
impl Unpin for SimpleRate
impl UnsafeUnpin for SimpleRate
impl !UnwindSafe for SimpleRate
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