Metrics not collected after ExecutorService recreation #5366
Labels
enhancement
A general enhancement
instrumentation
An issue that is related to instrumenting a component
module: micrometer-core
An issue that is related to our core module
Milestone
Describe the bug
When using Micrometer to collect metrics from an
ExecutorService
, I wrap it withExecutorServiceMetrics.monitor
. In the framework logic that I use, the original ExecutorService shuts down if it is not used for some time, and then it is recreated as needed. After it is recreated, metrics are not collected from it because it is created with the exact same name, and all methods likeThreadPoolExecutor::getCorePoolSize
are called on theThreadPoolExecutor
that has already been shut down. I have created a PR with a test for this problem and a potential fix.Environment
To Reproduce
How to reproduce the bug:
ExecutorService
withExecutorServiceMetrics.monitor.
Expected behavior
Metrics should continue to be collected from the recreated ExecutorService.
Additional context
The text was updated successfully, but these errors were encountered: