Search in sources :

Example 6 with Avg

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();
    }
}
Also used : Avg(org.apache.kafka.common.metrics.stats.Avg) Total(org.apache.kafka.common.metrics.stats.Total) Test(org.junit.Test)

Aggregations

Avg (org.apache.kafka.common.metrics.stats.Avg)6 Max (org.apache.kafka.common.metrics.stats.Max)4 Test (org.junit.Test)4 Count (org.apache.kafka.common.metrics.stats.Count)3 Total (org.apache.kafka.common.metrics.stats.Total)3 Min (org.apache.kafka.common.metrics.stats.Min)2 Percentile (org.apache.kafka.common.metrics.stats.Percentile)2 Percentiles (org.apache.kafka.common.metrics.stats.Percentiles)2 Rate (org.apache.kafka.common.metrics.stats.Rate)2 SimpleRate (org.apache.kafka.common.metrics.stats.SimpleRate)2 Metrics (org.apache.kafka.common.metrics.Metrics)1 Sensor (org.apache.kafka.common.metrics.Sensor)1