pub trait MetricValueProvider: Send + Sync {
// Required method
fn value(&self, config: &MetricConfig, now: i64) -> MetricValue;
// Provided method
fn type_name(&self) -> Option<&'static str> { ... }
}Expand description
Super-interface for Measurable or Gauge
that provides metric values.
§Translation notes
It yields a MetricValue.
Required Methods§
Sourcefn value(&self, config: &MetricConfig, now: i64) -> MetricValue
fn value(&self, config: &MetricConfig, now: i64) -> MetricValue
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.
Implementors§
impl<M: Measurable> MetricValueProvider for M
Java’s Measurable.value default: the measured quantity as a double.