conduktor.io ↗

KIP-843 — Adding addMetricIfAbsent method to Metrics

Accepted Kafka 3.3 Metrics

Adds `Metrics.addMetricIfAbsent(MetricName, Measurable)` as an atomic get-or-create operation on the metrics registry. The existing two-step pattern (check existence, then `addMetric`) is not thread-safe: concurrent threads registering the same instance-level metric race and one throws `IllegalArgumentException`.

Details

AuthorSagar Rao
StatusAccepted
Kafka Version3.3
JIRAKAFKA-13846
WikiView on Apache Wiki
Created2022-05-23
Last Modified2022-06-16
Explore how this KIP affects the Kafka protocol in the Protocol Explorer, or see the full KIP database.