pub trait Measurable: Send + Sync {
// Required method
fn measure(&self, config: &MetricConfig, now: i64) -> f64;
// Provided method
fn type_name(&self) -> Option<&'static str> { ... }
}Expand description
A measurable quantity that can be registered as a metric.
§Translation notes
Blanket-implements MetricValueProvider.
Required Methods§
Provided Methods§
Sourcefn 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.
Java’s KafkaMetric.toString reads the provider’s class name
reflectively and omits it for a lambda. Rust has no reflection, so the
provider reports it: the default is the implementing type’s
std::any::type_name, and the closure adapters answer None.
Implementations on Foreign Types§
Source§impl<M: Measurable + ?Sized> Measurable for Box<M>
A boxed measurable is a measurable, so Box<dyn Measurable> is a
crate::common::metrics::MetricValueProvider too.
impl<M: Measurable + ?Sized> Measurable for Box<M>
A boxed measurable is a measurable, so Box<dyn Measurable> is a
crate::common::metrics::MetricValueProvider too.