From 306241807157b14c79c4d0843a6f1dbb5d7a2702 Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:03:07 +0900 Subject: [PATCH] Note about wrapped ExecutorService types It can be unclear why metrics are missing when passing a wrapped type, as the API seems to indicate any `Executor` or `ExecutorService` can be monitored. This makes explicit the types we can monitor and notes unwrapping should be done by the user, since we cannot know wrapper types from external code. See gh-2443 and gh-2426 --- .../core/instrument/binder/jvm/ExecutorServiceMetrics.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java index 3b088adcac..cf19612f31 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java @@ -37,6 +37,10 @@ * Monitors the status of executor service pools. Does not record timings on operations executed in the {@link ExecutorService}, * as this requires the instance to be wrapped. Timings are provided separately by wrapping the executor service * with {@link TimedExecutorService}. + *

+ * Supports {@link ThreadPoolExecutor} and {@link ForkJoinPool} types of {@link ExecutorService}. Some libraries may provide + * a wrapper type for {@link ExecutorService}, like {@link TimedExecutorService}. Make sure to pass the underlying, + * unwrapped ExecutorService to this MeterBinder, if it is wrapped in another type. * * @author Jon Schneider * @author Clint Checketts