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§
- Closure
Gauge - A
Gaugebacked by a closure, mirroring Java’s functional-interface usage (e.g.(config, now) -> metrics.size()). - Closure
Measurable - A
Measurablebacked by a closure, mirroring Java’s functional-interface usage ofMeasurable(e.g.(config, now) -> TimeUnit.SECONDS.convert(...)inKafkaConsumerMetrics/HeartbeatMetricsManager). The symmetric counterpart ofcrate::common::metrics::ClosureGauge. - Kafka
Metric - A metric tracked by the registry. Holds a
MetricName, a (mutable)MetricConfigand aMetricValueProvider. - Metric
Config - Configuration values for metrics.
- Metrics
- A registry of sensors and metrics.
- Named
Measurable - A named
Measurablechild of aCompoundStat. - Quota
- An upper or lower bound for metrics.
- Quota
Violation Error - Raised when a sensor records a value that takes a metric outside the bounds configured as its quota.
- Sensor
Options - The parameters of
Metrics::sensor_options. - Sensor
Options Builder - Fluent builder for
SensorOptions.
Enums§
- Metric
Value Provider - Super-interface for
MeasurableorGaugethat provides metric values. - Time
Unit - A subset of
java.util.concurrent.TimeUnitused by the metrics rate stats.
Traits§
- Compound
Stat - 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.
- Measurable
Stat - A
MeasurableStatis aStatthat is alsoMeasurable(i.e. can produce a single floating point value). This is the interface used for most of the simple statistics such asAvg,Max,CumulativeCount, etc. - Metrics
Reporter - A plugin interface to allow things to listen as new metrics are created so they can be reported.
- Stat
- A
Statis a quantity such as average, max, etc that is computed off the stream of updates to a sensor.