use of org.apache.kafka.common.metrics.KafkaMetric in project apache-kafka-on-k8s by banzaicloud.
the class PushHttpMetricsReporter method init.
@Override
public void init(List<KafkaMetric> initMetrics) {
synchronized (lock) {
for (KafkaMetric metric : initMetrics) {
log.debug("Adding metric {}", metric.metricName());
metrics.put(metric.metricName(), metric);
}
}
}
use of org.apache.kafka.common.metrics.KafkaMetric in project apache-kafka-on-k8s by banzaicloud.
the class MeteredKeyValueBytesStoreTest method shouldWriteBytesToInnerStoreAndRecordPutMetric.
@Test
public void shouldWriteBytesToInnerStoreAndRecordPutMetric() {
inner.put(EasyMock.eq(keyBytes), EasyMock.aryEq(valueBytes));
EasyMock.expectLastCall();
init();
metered.put(key, value);
final KafkaMetric metric = metric("put-rate");
assertTrue(metric.value() > 0);
EasyMock.verify(inner);
}
use of org.apache.kafka.common.metrics.KafkaMetric in project apache-kafka-on-k8s by banzaicloud.
the class MeteredKeyValueBytesStoreTest method shouldGetRangeFromInnerStoreAndRecordRangeMetric.
@Test
public void shouldGetRangeFromInnerStoreAndRecordRangeMetric() {
EasyMock.expect(inner.range(keyBytes, keyBytes)).andReturn(new KeyValueIteratorStub<>(Collections.singletonList(KeyValue.pair(keyBytes, valueBytes)).iterator()));
init();
final KeyValueIterator<String, String> iterator = metered.range(key, key);
assertThat(iterator.next().value, equalTo(value));
assertFalse(iterator.hasNext());
iterator.close();
final KafkaMetric metric = metric("range-rate");
assertTrue(metric.value() > 0);
EasyMock.verify(inner);
}
use of org.apache.kafka.common.metrics.KafkaMetric in project apache-kafka-on-k8s by banzaicloud.
the class MeteredKeyValueBytesStoreTest method shouldFlushInnerWhenFlushTimeRecords.
@Test
public void shouldFlushInnerWhenFlushTimeRecords() {
inner.flush();
EasyMock.expectLastCall().once();
init();
metered.flush();
final KafkaMetric metric = metric("flush-rate");
assertTrue(metric.value() > 0);
EasyMock.verify(inner);
}
use of org.apache.kafka.common.metrics.KafkaMetric in project apache-kafka-on-k8s by banzaicloud.
the class MeteredKeyValueBytesStoreTest method shouldGetBytesFromInnerStoreAndReturnGetMetric.
@Test
public void shouldGetBytesFromInnerStoreAndReturnGetMetric() {
EasyMock.expect(inner.get(keyBytes)).andReturn(valueBytes);
init();
assertThat(metered.get(key), equalTo(value));
final KafkaMetric metric = metric("get-rate");
assertTrue(metric.value() > 0);
EasyMock.verify(inner);
}
Aggregations