ConsumerMetrics implements Metrics { @Override public void collect(Stats stats) { stats.put(statName("records_max_lag"), sum(recordsLagMax)); stats.put(statName("records_consumed_rate"), sum(recordsConsumedRate)); stats.put(statName("bytes_consumed_rate"), sum(bytesConsumedRate)); stats.put(statName("fetch_rate"), sum(fetchRate)); } ConsumerMetrics(String name); @Override void collect(Stats stats);  }
@Test void collect() { var metrics = new ConsumerMetrics(null); var stats = new Stats(); metrics.collect(stats); assertThat(stats.stats).containsKeys("kafka_consumer_records_max_lag", "kafka_consumer_records_consumed_rate", "kafka_consumer_bytes_consumed_rate", "kafka_consumer_fetch_rate"); }