Search in sources :

Example 1 with ImmutableMetricValue

use of org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.ImmutableMetricValue in project kafka by apache.

the class StreamsMetricsImplTest method shouldAddClientLevelImmutableMetric.

@Test
public void shouldAddClientLevelImmutableMetric() {
    final Metrics metrics = mock(Metrics.class);
    final RecordingLevel recordingLevel = RecordingLevel.INFO;
    final MetricConfig metricConfig = new MetricConfig().recordLevel(recordingLevel);
    final String value = "immutable-value";
    final ImmutableMetricValue immutableValue = new ImmutableMetricValue<>(value);
    expect(metrics.metricName(METRIC_NAME1, CLIENT_LEVEL_GROUP, DESCRIPTION1, clientLevelTags)).andReturn(metricName1);
    metrics.addMetric(eq(metricName1), eqMetricConfig(metricConfig), eq(immutableValue));
    replay(metrics);
    final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time);
    streamsMetrics.addClientLevelImmutableMetric(METRIC_NAME1, DESCRIPTION1, recordingLevel, value);
    verify(metrics);
}
Also used : RecordingLevel(org.apache.kafka.common.metrics.Sensor.RecordingLevel) MetricConfig(org.apache.kafka.common.metrics.MetricConfig) Metrics(org.apache.kafka.common.metrics.Metrics) EasyMock.anyString(org.easymock.EasyMock.anyString) ImmutableMetricValue(org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.ImmutableMetricValue) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

MetricConfig (org.apache.kafka.common.metrics.MetricConfig)1 Metrics (org.apache.kafka.common.metrics.Metrics)1 RecordingLevel (org.apache.kafka.common.metrics.Sensor.RecordingLevel)1 ImmutableMetricValue (org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.ImmutableMetricValue)1 EasyMock.anyString (org.easymock.EasyMock.anyString)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1