use of org.apache.kafka.common.metrics.Sensor.RecordingLevel in project kafka by apache.
the class StreamsMetricsImplTest method shouldAddClientLevelMutableMetric.
@Test
public void shouldAddClientLevelMutableMetric() {
final Metrics metrics = mock(Metrics.class);
final RecordingLevel recordingLevel = RecordingLevel.INFO;
final MetricConfig metricConfig = new MetricConfig().recordLevel(recordingLevel);
final Gauge<String> valueProvider = (config, now) -> "mutable-value";
expect(metrics.metricName(METRIC_NAME1, CLIENT_LEVEL_GROUP, DESCRIPTION1, clientLevelTags)).andReturn(metricName1);
metrics.addMetric(EasyMock.eq(metricName1), eqMetricConfig(metricConfig), eq(valueProvider));
replay(metrics);
final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
streamsMetrics.addClientLevelMutableMetric(METRIC_NAME1, DESCRIPTION1, recordingLevel, valueProvider);
verify(metrics);
}
use of org.apache.kafka.common.metrics.Sensor.RecordingLevel in project kafka by apache.
the class StreamsMetricsImplTest method shouldGetExistingNodeLevelSensor.
@Test
public void shouldGetExistingNodeLevelSensor() {
final Metrics metrics = mock(Metrics.class);
final RecordingLevel recordingLevel = RecordingLevel.INFO;
final String processorNodeName = "processorNodeName";
setupGetExistingSensorTest(metrics);
final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
final Sensor actualSensor = streamsMetrics.nodeLevelSensor(THREAD_ID1, TASK_ID1, processorNodeName, SENSOR_NAME_1, recordingLevel);
verify(metrics);
assertThat(actualSensor, is(equalToObject(sensor)));
}
use of org.apache.kafka.common.metrics.Sensor.RecordingLevel in project kafka by apache.
the class StreamsMetricsImplTest method shouldGetExistingThreadLevelSensor.
@Test
public void shouldGetExistingThreadLevelSensor() {
final Metrics metrics = mock(Metrics.class);
final RecordingLevel recordingLevel = RecordingLevel.INFO;
setupGetExistingSensorTest(metrics);
final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
final Sensor actualSensor = streamsMetrics.threadLevelSensor(THREAD_ID1, SENSOR_NAME_1, recordingLevel);
verify(metrics);
assertThat(actualSensor, is(equalToObject(sensor)));
}
use of org.apache.kafka.common.metrics.Sensor.RecordingLevel in project kafka by apache.
the class StreamsMetricsImplTest method shouldGetExistingCacheLevelSensor.
@Test
public void shouldGetExistingCacheLevelSensor() {
final Metrics metrics = mock(Metrics.class);
final RecordingLevel recordingLevel = RecordingLevel.INFO;
final String processorCacheName = "processorNodeName";
setupGetExistingSensorTest(metrics);
final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
final Sensor actualSensor = streamsMetrics.cacheLevelSensor(THREAD_ID1, TASK_ID1, processorCacheName, SENSOR_NAME_1, recordingLevel);
verify(metrics);
assertThat(actualSensor, is(equalToObject(sensor)));
}
use of org.apache.kafka.common.metrics.Sensor.RecordingLevel in project kafka by apache.
the class StreamsMetricsImplTest method shouldGetNewThreadLevelSensor.
@Test
public void shouldGetNewThreadLevelSensor() {
final Metrics metrics = mock(Metrics.class);
final RecordingLevel recordingLevel = RecordingLevel.INFO;
setupGetNewSensorTest(metrics, recordingLevel);
final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
final Sensor actualSensor = streamsMetrics.threadLevelSensor(THREAD_ID1, SENSOR_NAME_1, recordingLevel);
verify(metrics);
assertThat(actualSensor, is(equalToObject(sensor)));
}
Aggregations