public final class KafkaMetricHistogram extends Object implements org.apache.kafka.common.metrics.CompoundStat
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
.Modifier and Type | Method and Description |
---|---|
static KafkaMetricHistogram |
newLatencyHistogram(Function<String,org.apache.kafka.common.MetricName> metricNameFactory,
long highestTrackableValue)
Creates a new histogram with the purpose of tracking latency values.
|
void |
record(org.apache.kafka.common.metrics.MetricConfig config,
double value,
long timeMs) |
List<org.apache.kafka.common.metrics.CompoundStat.NamedMeasurable> |
stats() |
public static KafkaMetricHistogram newLatencyHistogram(Function<String,org.apache.kafka.common.MetricName> metricNameFactory, long highestTrackableValue)
metricNameFactory
- A factory for creating a MetricName
based 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.KafkaMetricHistogram
with the configured properties.public List<org.apache.kafka.common.metrics.CompoundStat.NamedMeasurable> stats()
stats
in interface org.apache.kafka.common.metrics.CompoundStat
public void record(org.apache.kafka.common.metrics.MetricConfig config, double value, long timeMs)
record
in interface org.apache.kafka.common.metrics.Stat