Constructor and Description |
---|
MetricUtil() |
Modifier and Type | Method and Description |
---|---|
static org.apache.kafka.common.Metric |
getKafkaMetric(Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics,
java.util.function.Predicate<Map.Entry<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric>> filter)
Tries to find the Kafka
Metric in the provided metrics matching a given filter. |
static org.apache.kafka.common.Metric |
getKafkaMetric(Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics,
String metricGroup,
String metricName)
Tries to find the Kafka
Metric in the provided metrics. |
static void |
sync(org.apache.kafka.common.Metric from,
Counter to)
Ensures that the counter has the same value as the given Kafka metric.
|
public static org.apache.kafka.common.Metric getKafkaMetric(Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics, String metricGroup, String metricName)
Metric
in the provided metrics.Metric
which exposes continuous updatesIllegalStateException
- if the metric is not part of the provided metricspublic static org.apache.kafka.common.Metric getKafkaMetric(Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics, java.util.function.Predicate<Map.Entry<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric>> filter)
Metric
in the provided metrics matching a given filter.Metric
which exposes continuous updatesIllegalStateException
- if no metric matches the given filterpublic static void sync(org.apache.kafka.common.Metric from, Counter to)
Do not use this method for every record because Metric.metricValue()
is an
expensive operation.
from
- Kafka's Metric
to queryto
- Counter
to write the value toCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.