pub trait MetricsReporter: Send + Sync {
// Provided methods
fn init(&self, metrics: &[Arc<KafkaMetric>]) { ... }
fn metric_change(&self, metric: &Arc<KafkaMetric>) { ... }
fn metric_removal(&self, metric: &Arc<KafkaMetric>) { ... }
fn close(&self) { ... }
}Expand description
A plugin interface to allow things to listen as new metrics are created so they can be reported.
Java’s MetricsReporter extends Reconfigurable, AutoCloseable and (via
JmxReporter) bridges to JMX. JMX is JVM-only and out of scope; this trait
keeps the registration seam (init/metric_change/metric_removal/close)
so non-JMX reporters can be plugged in. All methods have a no-op default,
so a do-nothing reporter only needs an empty impl.
Provided Methods§
Sourcefn init(&self, metrics: &[Arc<KafkaMetric>])
fn init(&self, metrics: &[Arc<KafkaMetric>])
This is called when the reporter is first registered to initially register all existing metrics.
metrics- All currently existing metrics
Sourcefn metric_change(&self, metric: &Arc<KafkaMetric>)
fn metric_change(&self, metric: &Arc<KafkaMetric>)
This is called whenever a metric is updated or added.
metric- The metric that has been added or changed
Sourcefn metric_removal(&self, metric: &Arc<KafkaMetric>)
fn metric_removal(&self, metric: &Arc<KafkaMetric>)
This is called whenever a metric is removed.
metric- The metric that has been removed