You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a possible implementation it might be some like that:
`
public class InstrumentedExecutorService implements ExecutorService {
private static final AtomicLong NAME_COUNTER = new AtomicLong();
private final ExecutorService delegate;
private final Rate submitted;
private final Counter running;
private final Rate completed;
private final Timer idle;
private final Timer duration;
and
`
public class InstrumentedScheduledExecutorService implements ScheduledExecutorService {
private static final AtomicLong NAME_COUNTER = new AtomicLong();
private final ScheduledExecutorService delegate;
private final Rate submitted;
private final Counter running;
private final Rate completed;
private final Timer duration;
private final Rate scheduledOnce;
private final Rate scheduledRepetitively;
private final Counter scheduledOverrun;
private final Histogram percentOfPeriod;
Currently there are a lot of frameworks for metrics which provides possibility to monitor metrics for executor service and scheduled executor service.
For example, dropwizard framework provides Instrumented implementation for executor service:
https://github.com/dropwizard/metrics/blob/release/4.2.x/metrics-core/src/main/java/com/codahale/metrics/InstrumentedExecutorService.java
and for scheduled executor service:
https://github.com/dropwizard/metrics/blob/release/4.2.x/metrics-core/src/main/java/com/codahale/metrics/InstrumentedScheduledExecutorService.java
Micrometer provides binders for executor service like:
https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java
As a possible implementation it might be some like that:
`
public class InstrumentedExecutorService implements ExecutorService {
private static final AtomicLong NAME_COUNTER = new AtomicLong();
private final ExecutorService delegate;
private final Rate submitted;
private final Counter running;
private final Rate completed;
private final Timer idle;
private final Timer duration;
}
`
and
`
public class InstrumentedScheduledExecutorService implements ScheduledExecutorService {
private static final AtomicLong NAME_COUNTER = new AtomicLong();
private final ScheduledExecutorService delegate;
private final Rate submitted;
private final Counter running;
private final Rate completed;
private final Timer duration;
private final Rate scheduledOnce;
private final Rate scheduledRepetitively;
private final Counter scheduledOverrun;
private final Histogram percentOfPeriod;
}
`
The text was updated successfully, but these errors were encountered: