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());
}
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());
}
Aggregations