Search in sources :

Example 1 with CumulativeCount

use of org.apache.kafka.common.metrics.stats.CumulativeCount in project kafka by apache.

the class StreamsMetricsImpl method addInvocationRateAndCountToSensor.

public static void addInvocationRateAndCountToSensor(final Sensor sensor, final String group, final Map<String, String> tags, final String operation, final String descriptionOfRate, final String descriptionOfCount) {
    addInvocationRateToSensor(sensor, group, tags, operation, descriptionOfRate);
    sensor.add(new MetricName(operation + TOTAL_SUFFIX, group, descriptionOfCount, tags), new CumulativeCount());
}
Also used : MetricName(org.apache.kafka.common.MetricName) CumulativeCount(org.apache.kafka.common.metrics.stats.CumulativeCount)

Example 2 with CumulativeCount

use of org.apache.kafka.common.metrics.stats.CumulativeCount in project kafka by apache.

the class SensorTest method shouldReturnPresenceOfMetrics.

@Test
public void shouldReturnPresenceOfMetrics() {
    final Metrics metrics = new Metrics();
    final Sensor sensor = metrics.sensor("sensor");
    assertFalse(sensor.hasMetrics());
    sensor.add(new MetricName("name1", "group1", "description1", Collections.emptyMap()), new WindowedSum());
    assertTrue(sensor.hasMetrics());
    sensor.add(new MetricName("name2", "group2", "description2", Collections.emptyMap()), new CumulativeCount());
    assertTrue(sensor.hasMetrics());
}
Also used : MetricName(org.apache.kafka.common.MetricName) CumulativeCount(org.apache.kafka.common.metrics.stats.CumulativeCount) WindowedSum(org.apache.kafka.common.metrics.stats.WindowedSum) Test(org.junit.jupiter.api.Test)

Aggregations

MetricName (org.apache.kafka.common.MetricName)2 CumulativeCount (org.apache.kafka.common.metrics.stats.CumulativeCount)2 WindowedSum (org.apache.kafka.common.metrics.stats.WindowedSum)1 Test (org.junit.jupiter.api.Test)1