Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics not collected after ExecutorService recreation #5366

Closed
ajax-surovskyi-y opened this issue Aug 2, 2024 · 0 comments
Closed

Metrics not collected after ExecutorService recreation #5366

ajax-surovskyi-y opened this issue Aug 2, 2024 · 0 comments
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

Comments

@ajax-surovskyi-y
Copy link
Contributor

ajax-surovskyi-y commented Aug 2, 2024

Describe the bug
When using Micrometer to collect metrics from an ExecutorService, I wrap it with ExecutorServiceMetrics.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 like ThreadPoolExecutor::getCorePoolSize are called on the ThreadPoolExecutor that has already been shut down. I have created a PR with a test for this problem and a potential fix.
Environment

  • Micrometer version 1.13.1
  • Micrometer registry statsd
  • OS: Linux
  • Java version: 21.0.1

To Reproduce
How to reproduce the bug:

  1. Wrap an ExecutorService with ExecutorServiceMetrics.monitor.
  2. Allow the shutdown.
  3. Recreate the ExecutorService.
  4. Observe that metrics are not being collected.

Expected behavior
Metrics should continue to be collected from the recreated ExecutorService.

Additional context

@shakuzen shakuzen added enhancement A general enhancement module: micrometer-core An issue that is related to our core module instrumentation An issue that is related to instrumenting a component and removed waiting-for-triage labels Aug 9, 2024
@shakuzen shakuzen added this to the 1.x milestone Aug 9, 2024
@shakuzen shakuzen modified the milestones: 1.x, 1.14.0-M3 Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants