use of com.wavefront.internal_reporter_java.io.dropwizard.metrics5.WavefrontHistogram in project java by wavefrontHQ.
the class CustomTracingPortUnificationHandlerTest method reportsCorrectDuration.
@Test
public void reportsCorrectDuration() {
WavefrontInternalReporter reporter = EasyMock.niceMock(WavefrontInternalReporter.class);
expect(reporter.newDeltaCounter(anyObject())).andReturn(new DeltaCounter()).anyTimes();
WavefrontHistogram histogram = EasyMock.niceMock(WavefrontHistogram.class);
expect(reporter.newWavefrontHistogram(anyObject(), anyObject())).andReturn(histogram);
Capture<Long> duration = newCapture();
histogram.update(captureLong(duration));
expectLastCall();
ReportableEntityHandler<Span, String> handler = MockReportableEntityHandlerFactory.getMockTraceHandler();
CustomTracingPortUnificationHandler subject = new CustomTracingPortUnificationHandler(null, null, null, null, null, null, handler, null, null, null, null, null, reporter, null, null, null);
replay(reporter, histogram);
Span span = getSpan();
// milliseconds
span.setDuration(1000);
subject.report(span);
verify(reporter, histogram);
long value = duration.getValue();
// microseconds
assertEquals(1000000, value);
}
Aggregations