use of org.apache.kafka.streams.StreamsMetrics in project kafka by apache.
the class MeteredSegmentedBytesStoreTest method setUp.
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
final Metrics metrics = new Metrics();
final StreamsMetrics streamsMetrics = new StreamsMetrics() {
@Override
public Map<MetricName, ? extends Metric> metrics() {
return Collections.unmodifiableMap(metrics.metrics());
}
@Override
public Sensor addLatencyAndThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordLevel, String... tags) {
return metrics.sensor(operationName);
}
@Override
public void recordLatency(final Sensor sensor, final long startNs, final long endNs) {
latencyRecorded.add(sensor.name());
}
@Override
public Sensor addThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordLevel, String... tags) {
return metrics.sensor(operationName);
}
@Override
public void recordThroughput(Sensor sensor, long value) {
throughputRecorded.add(sensor.name());
}
@Override
public void removeSensor(Sensor sensor) {
metrics.removeSensor(sensor.name());
}
@Override
public Sensor addSensor(String name, Sensor.RecordingLevel recordLevel) {
return metrics.sensor(name);
}
@Override
public Sensor addSensor(String name, Sensor.RecordingLevel recordLevel, Sensor... parents) {
return metrics.sensor(name);
}
};
final MockProcessorContext context = new MockProcessorContext(TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), new NoOpRecordCollector(), new ThreadCache("testCache", 0, streamsMetrics)) {
@Override
public StreamsMetrics metrics() {
return streamsMetrics;
}
};
store.init(context, store);
}
use of org.apache.kafka.streams.StreamsMetrics in project kafka by apache.
the class RocksDBWindowStoreSupplierTest method shouldHaveMeteredStoreWhenLogged.
@SuppressWarnings("unchecked")
@Test
public void shouldHaveMeteredStoreWhenLogged() throws Exception {
store = createStore(true, false);
store.init(context, store);
final StreamsMetrics metrics = context.metrics();
assertFalse(metrics.metrics().isEmpty());
}
use of org.apache.kafka.streams.StreamsMetrics in project kafka by apache.
the class RocksDBWindowStoreSupplierTest method shouldHaveMeteredStoreWhenCached.
@SuppressWarnings("unchecked")
@Test
public void shouldHaveMeteredStoreWhenCached() throws Exception {
store = createStore(false, true);
store.init(context, store);
final StreamsMetrics metrics = context.metrics();
assertFalse(metrics.metrics().isEmpty());
}
use of org.apache.kafka.streams.StreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class RocksDBSessionStoreSupplierTest method shouldHaveMeteredStoreWhenLogged.
@Test
public void shouldHaveMeteredStoreWhenLogged() {
store = createStore(true, false);
store.init(context, store);
final StreamsMetrics metrics = context.metrics();
assertFalse(metrics.metrics().isEmpty());
}
use of org.apache.kafka.streams.StreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class RocksDBWindowStoreSupplierTest method shouldHaveMeteredStoreWhenLogged.
@Test
public void shouldHaveMeteredStoreWhenLogged() {
store = createStore(true, false, 3);
store.init(context, store);
final StreamsMetrics metrics = context.metrics();
assertFalse(metrics.metrics().isEmpty());
}
Aggregations