public static final class KafkaMetricsCollector.StateLedger
extends java.lang.Object
implements org.apache.kafka.common.metrics.MetricsReporter
Note that this class doesn't have a context object, so it can't use the real MetricKey (with contex.labels()). The StateLedger is created earlier in the process so that it can handle the MetricsReporter methods (init/metricChange,metricRemoval).
Constructor and Description |
---|
StateLedger() |
StateLedger(LastValueTracker<java.lang.Double> doubleDeltas,
java.time.Clock clock) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs) |
LastValueTracker.InstantAndValue<java.lang.Double> |
delta(org.apache.kafka.common.MetricName metricName,
java.time.Instant now,
java.lang.Double value) |
java.lang.Iterable<? extends java.util.Map.Entry<org.apache.kafka.common.MetricName,org.apache.kafka.common.metrics.KafkaMetric>> |
getMetrics() |
void |
init(java.util.List<org.apache.kafka.common.metrics.KafkaMetric> metrics) |
void |
metricChange(org.apache.kafka.common.metrics.KafkaMetric metric) |
void |
metricRemoval(org.apache.kafka.common.metrics.KafkaMetric metric) |
public StateLedger()
public StateLedger(LastValueTracker<java.lang.Double> doubleDeltas, java.time.Clock clock)
public void init(java.util.List<org.apache.kafka.common.metrics.KafkaMetric> metrics)
init
in interface org.apache.kafka.common.metrics.MetricsReporter
public void metricChange(org.apache.kafka.common.metrics.KafkaMetric metric)
metricChange
in interface org.apache.kafka.common.metrics.MetricsReporter
public void metricRemoval(org.apache.kafka.common.metrics.KafkaMetric metric)
metricRemoval
in interface org.apache.kafka.common.metrics.MetricsReporter
public java.lang.Iterable<? extends java.util.Map.Entry<org.apache.kafka.common.MetricName,org.apache.kafka.common.metrics.KafkaMetric>> getMetrics()
public LastValueTracker.InstantAndValue<java.lang.Double> delta(org.apache.kafka.common.MetricName metricName, java.time.Instant now, java.lang.Double value)
public void close()
close
in interface java.lang.AutoCloseable
close
in interface org.apache.kafka.common.metrics.MetricsReporter
public void configure(java.util.Map<java.lang.String,?> configs)
configure
in interface org.apache.kafka.common.Configurable