ConsumerMetrics implements Metrics { String statName(String statName) { var builder = new StringBuilder("kafka_consumer"); if (name != null) builder.append('_').append(name); builder.append('_').append(statName); return builder.toString(); } ConsumerMetrics(String name); @Override void collect(Stats stats);  }
@Test void statName() { var metrics = new ConsumerMetrics("log"); assertEquals("kafka_consumer_log_lag_max", metrics.statName("lag_max")); metrics = new ConsumerMetrics(null); assertEquals("kafka_consumer_lag_max", metrics.statName("lag_max")); }