Skip to main content

Module metrics

Module metrics 

Source
Expand description

The Kafka metrics framework (org.apache.kafka.common.metrics).

Faithful translation of the Java metrics core: same class names, file-per- class, identical metric values / names / recording-level gating. Java’s synchronized is mapped to the minimal Rust atomic/lock equivalent (atomics for pure-counter stats, Mutex where multi-field mutation needs it). JMX is replaced by the MetricsReporter trait seam.

Re-exports§

pub use sensor::RecordingLevel;
pub use sensor::Sensor;

Modules§

sensor
A sensor applies a continuous sequence of numerical values to a set of associated metrics (org.apache.kafka.common.metrics.Sensor).
stats
Concrete statistics (org.apache.kafka.common.metrics.stats).

Structs§

ClosureGauge
A Gauge backed by a closure, mirroring Java’s functional-interface usage (e.g. (config, now) -> metrics.size()).
ClosureMeasurable
A Measurable backed by a closure, mirroring Java’s functional-interface usage of Measurable (e.g. (config, now) -> TimeUnit.SECONDS.convert(...) in KafkaConsumerMetrics / HeartbeatMetricsManager). The symmetric counterpart of crate::common::metrics::ClosureGauge.
KafkaMetric
A metric tracked by the registry. Holds a MetricName, a (mutable) MetricConfig and a MetricValueProvider.
MetricConfig
Configuration values for metrics.
Metrics
A registry of sensors and metrics.
NamedMeasurable
A named Measurable child of a CompoundStat.
Quota
An upper or lower bound for metrics.
QuotaViolationError
Raised when a sensor records a value that takes a metric outside the bounds configured as its quota.
SensorOptions
The parameters of Metrics::sensor_options.
SensorOptionsBuilder
Fluent builder for SensorOptions.

Enums§

MetricValueProvider
Super-interface for Measurable or Gauge that provides metric values.
TimeUnit
A subset of java.util.concurrent.TimeUnit used by the metrics rate stats.

Traits§

CompoundStat
A compound stat is a stat where a single measurement and associated data structure feeds many metrics. This is the example for a histogram which has many associated percentiles.
Gauge
A gauge metric is an instantaneous reading of a particular value.
Measurable
A measurable quantity that can be registered as a metric.
MeasurableStat
A MeasurableStat is a Stat that is also Measurable (i.e. can produce a single floating point value). This is the interface used for most of the simple statistics such as Avg, Max, CumulativeCount, etc.
MetricsReporter
A plugin interface to allow things to listen as new metrics are created so they can be reported.
Stat
A Stat is a quantity such as average, max, etc that is computed off the stream of updates to a sensor.