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 gauge::Gauge;pub use metric_value_provider::MetricValueProvider;pub use sensor::RecordingLevel;pub use sensor::Sensor;
Modules§
- gauge
- A gauge metric is an instantaneous reading of a particular value
(
org.apache.kafka.common.metrics.Gauge). - metric_
value_ provider - Super-interface for
MeasurableorGaugethat provides metric values (org.apache.kafka.common.metrics.MetricValueProvider). - 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
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::gauge::new. - 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.
- Metrics
View - A live, read-only view of the metrics of a client, indexed by metric name:
what Java’s clients return from
metrics()asCollections.unmodifiableMap(metrics.metrics()). - Named
Measurable - A named
Measurablechild of aCompoundStat. - Quota
- An upper or lower bound for metrics.
- Quota
Violation Error - Thrown when a sensor records a value that causes a metric to go outside the bounds configured as its quota
- Sensor
Options - The parameters of
Metrics::sensor_with_options. - Sensor
Options Builder - Fluent builder for
SensorOptions.
Enums§
- 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.
- 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.