Class KafkaMetricHistogram
java.lang.Object
io.confluent.kafka.replication.push.metrics.KafkaMetricHistogram
- All Implemented Interfaces:
org.apache.kafka.common.metrics.CompoundStat,org.apache.kafka.common.metrics.Stat
public final class KafkaMetricHistogram
extends Object
implements org.apache.kafka.common.metrics.CompoundStat
A compound stat providing various metrics based on an internally maintained
HdrHistogram.
It should be more performant, more precise, and much more flexible regarding concurrent usage
compared to either the most commonly used in the Kafka codebase Yammer histograms or the existing
Kafka Metrics alternatives like Percentiles.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.kafka.common.metrics.CompoundStat
org.apache.kafka.common.metrics.CompoundStat.NamedMeasurable -
Method Summary
Modifier and TypeMethodDescriptionstatic KafkaMetricHistogramnewLatencyHistogram(Function<String, org.apache.kafka.common.MetricName> metricNameFactory, long highestTrackableValue) Creates a new histogram with the purpose of tracking latency values.voidrecord(org.apache.kafka.common.metrics.MetricConfig config, double value, long timeMs) List<org.apache.kafka.common.metrics.CompoundStat.NamedMeasurable> stats()
-
Method Details
-
newLatencyHistogram
public static KafkaMetricHistogram newLatencyHistogram(Function<String, org.apache.kafka.common.MetricName> metricNameFactory, long highestTrackableValue) Creates a new histogram with the purpose of tracking latency values. As such, the histogram defaults to a thread-safety mode allowing concurrent reads and writes and 3-digit precision across its range (higher precision significantly increases the memory footprint of the histogram and is rarely needed).- Parameters:
metricNameFactory- A factory for creating aMetricNamebased on a metric name string.highestTrackableValue- The maximum trackable value for the histogram, e.g. something with some safety margin above the configured request timeout for request latencies.- Returns:
- A new
KafkaMetricHistogramwith the configured properties.
-
stats
- Specified by:
statsin interfaceorg.apache.kafka.common.metrics.CompoundStat
-
record
public void record(org.apache.kafka.common.metrics.MetricConfig config, double value, long timeMs) - Specified by:
recordin interfaceorg.apache.kafka.common.metrics.Stat
-