use of org.apache.kafka.streams.processor.internals.StreamThreadTotalBlockedTime in project kafka by apache.
the class ThreadMetricsTest method shouldAddTotalBlockedTimeMetric.
@Test
public void shouldAddTotalBlockedTimeMetric() {
// Given:
final double startTime = 123.45;
final StreamThreadTotalBlockedTime blockedTime = mock(StreamThreadTotalBlockedTime.class);
when(blockedTime.compute()).thenReturn(startTime);
// When:
ThreadMetrics.addThreadBlockedTimeMetric("burger", blockedTime, streamsMetrics);
// Then:
final ArgumentCaptor<Gauge<Double>> captor = gaugeCaptor();
verify(streamsMetrics).addThreadLevelMutableMetric(eq("blocked-time-ns-total"), eq("The total time the thread spent blocked on kafka in nanoseconds"), eq("burger"), captor.capture());
assertThat(captor.getValue().value(null, 678L), is(startTime));
}
Aggregations