@Test public void testInstrumentsSuccessfulCall() throws Exception { // Given final CollectorRegistry registry = new CollectorRegistry(); final CallMeter timer = CallMeter.ofCollectorRegistry("some_call", "Some help", registry); // When timer.executeRunnable(() -> { try { Thread.sleep(50); } catch (InterruptedException e) { fail(); } }); // Then assertThat(registry.getSampleValue( "some_call_total", new String[]{}, new String[]{})) .isEqualTo(1.0); assertThat(registry.getSampleValue( "some_call_failures_total", new String[]{}, new String[]{})) .isEqualTo(0.0); assertThat(registry.getSampleValue( "some_call_latency_count", new String[]{}, new String[]{})) .isEqualTo(1.0); }
timer.executeRunnable(() -> { try { Thread.sleep(50);