pub trait Stat: Send + Sync {
// Required method
fn record(&self, config: &MetricConfig, value: f64, time_ms: i64);
}Expand description
A Stat is a quantity such as average, max, etc that is computed off the
stream of updates to a sensor.
record takes &self: the simple cumulative stats use interior mutability
(atomics) so that recording is lock-free, which is the minimal Rust
equivalent of Java guarding the stat field with the sensor’s synchronized.
Required Methods§
Sourcefn record(&self, config: &MetricConfig, value: f64, time_ms: i64)
fn record(&self, config: &MetricConfig, value: f64, time_ms: i64)
Record the given value.
config- The configuration to use for this metricvalue- The value to recordtime_ms- The POSIX time in milliseconds this value occurred