Search in sources :

Example 1 with Timer

use of io.jaegertracing.internal.metrics.Timer in project jaeger-client-java by jaegertracing.

the class MicrometerTest method testTimer.

@Test
public void testTimer() {
    // we have no timers on the Metrics class yet, so, we simulate one
    Map<String, String> tags = new HashMap<>(1);
    tags.put("akey", "avalue");
    Timer timer = new MicrometerMetricsFactory().createTimer("jaeger_tracer_timed_operation", tags);
    timer.durationMicros(100);
    assertThat(registry.get("jaeger_tracer_timed_operation").timer().totalTime(TimeUnit.MICROSECONDS), IsEqual.equalTo(100d));
    assertTrue(prometheusRegistry.scrape().contains("jaeger_tracer_timed_operation_seconds"));
}
Also used : Timer(io.jaegertracing.internal.metrics.Timer) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

Timer (io.jaegertracing.internal.metrics.Timer)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1