use of org.apache.kafka.common.metrics.stats.Avg in project kafka by apache.
the class JmxReporterTest method testJmxRegistration.
@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();
}
}
Aggregations