Search in sources :

Example 1 with TimedResource

use of io.micrometer.jersey2.server.resources.TimedResource in project micrometer by micrometer-metrics.

the class MetricsRequestEventListenerTimedTest method configure.

@Override
protected Application configure() {
    registry = new SimpleMeterRegistry();
    longTaskRequestStartedLatch = new CountDownLatch(1);
    longTaskRequestReleaseLatch = new CountDownLatch(1);
    final MetricsApplicationEventListener listener = new MetricsApplicationEventListener(registry, new DefaultJerseyTagsProvider(), METRIC_NAME, false);
    final ResourceConfig config = new ResourceConfig();
    config.register(listener);
    config.register(new TimedResource(longTaskRequestStartedLatch, longTaskRequestReleaseLatch));
    config.register(TimedOnClassResource.class);
    return config;
}
Also used : TimedResource(io.micrometer.jersey2.server.resources.TimedResource) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 TimedResource (io.micrometer.jersey2.server.resources.TimedResource)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)1