Search in sources :

Example 1 with ExecutorServiceMetrics

use of io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics in project micrometer by micrometer-metrics.

the class ExecutorServiceSample method main.

public static void main(String[] args) {
    MeterRegistry registry = SampleConfig.myMonitoringSystem();
    ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
    new ExecutorServiceMetrics(es, "executor.sample", emptyList()).bindTo(registry);
    es.scheduleWithFixedDelay(() -> Mono.delay(Duration.ofMillis(20)).block(), 0, 10, TimeUnit.MILLISECONDS);
    while (true) {
    }
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorServiceMetrics(io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics) MeterRegistry(io.micrometer.core.instrument.MeterRegistry)

Aggregations

MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 ExecutorServiceMetrics (io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1