@Test public void testJmxRegistration() throws Exception { Metrics metrics = new Metrics(); try { metrics.addReporter(new JmxReporter()); Sensor sensor = metrics.sensor("kafka.requests"); sensor.add(metrics.metricName("pack.bean1.avg", "grp1"), new Avg()); sensor.add(metrics.metricName("pack.bean2.total", "grp2"), new Total()); Sensor sensor2 = metrics.sensor("kafka.blah"); sensor2.add(metrics.metricName("pack.bean1.some", "grp1"), new Total()); sensor2.add(metrics.metricName("pack.bean2.some", "grp1"), new Total()); } finally { metrics.close(); } }
public void close() { synchronized (LOCK) { for (KafkaMbean mbean : this.mbeans.values()) unregister(mbean); } }
JmxReporter implements MetricsReporter { public void close() { synchronized (LOCK) { for (KafkaMbean mbean : this.mbeans.values()) unregister(mbean); } } }
JmxReporter implements MetricsReporter { public void close() { synchronized (LOCK) { for (KafkaMbean mbean : this.mbeans.values()) unregister(mbean); } } JmxReporter();  JmxReporter(String prefix); }
JmxReporter implements MetricsReporter { public void close() { synchronized (LOCK) { for (KafkaMbean mbean : this.mbeans.values()) unregister(mbean); } } JmxReporter();  JmxReporter(String prefix); @Override void configure(Map<String, ?> configs); @Override void init(List<KafkaMetric> metrics); @Override void metricChange(KafkaMetric metric); @Override void metricRemoval(KafkaMetric metric); void close(); }
JmxReporter implements MetricsReporter { public void close() { synchronized (LOCK) { for (KafkaMbean mbean : this.mbeans.values()) unregister(mbean); } } JmxReporter();  JmxReporter(String prefix); @Override void configure(Map<String, ?> configs); @Override void init(List<KafkaMetric> metrics); @Override void metricChange(KafkaMetric metric); @Override void metricRemoval(KafkaMetric metric); void close();  }