THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
"records-lead-min"
Also, add per-partition lead metrics metric to KafkaConsumer. The metric names name would be:
"TOPIC-PARTITION_ID.records-lead"
"TOPIC-PARTITION_ID.records-lead-avg"
"TOPIC-PARTITION_ID.records-lead-min"
The way to get the metrics is the same as getting other metrics. For example:
Code Block | ||
---|---|---|
| ||
TopicPartition tp = new TopicPartition("topic", 0); HashMap<String, String> tags = new HashMap<>(); tags.put("client-id", "metricTestConsumer0"); double currentLead = kafkaConsumer.metrics().get(new MetricName(tp + ".records-lead", "consumer-fetch-manager-metrics", "", tags)).value() double averageLead = kafkaConsumer.metrics().get(new MetricName(tp + ".records-lead-avg", "consumer-fetch-manager-metrics", "", tags)).value() double minLeadtags.put("topic", tp.topic()); tags.put("partition", String.valueOf(tp0.partition()); double currentLead = kafkaConsumer.metrics().get(new MetricName(tp + ".records-lead-min", "consumer-fetch-manager-metrics", "", tags)).value() |
...