Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The way to get the metrics is the same as getting other metrics. For example:

Code Block
languagejava
TopicPartition tp = new TopicPartition("topic", 0);
HashMap<String, String> tags = new HashMap<>();
tags.put("client-id", "metricTestConsumer0");

double currentLag = consumer0.metrics().get(new MetricName(tp + ".records-lag", "consumer-fetch-manager-metrics", "", tags)).value()
double averageLag = consumer0.metrics().get(new MetricName(tp + ".records-lag-avg", "consumer-fetch-manager-metrics", "", tags)).value()
double maxLag = consumer0.metrics().get(new MetricName(tp + ".records-lag-max", "consumer-fetch-manager-metrics", "", tags)).value()

...