-
Notifications
You must be signed in to change notification settings - Fork 868
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
Use app's thread context class loader for callbacks into app #9000
Use app's thread context class loader for callbacks into app #9000
Conversation
Is there a problem with how the gauge functions are run? Why would we want to touch the context CL in the first place? |
Thanks, I completely forgot about that issue 😅 (I did remember removing the The same issue also applies to |
.../src/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/LongMeasurementRecorder.java
Outdated
Show resolved
Hide resolved
Context classloader, and if not set then |
Thank you for taking up the issue! We had to disable a few interesting metrics due to this when moving to metrics collection via the agent. I'm really looking forward to re-enabling them. |
@sebastian-hans-swm could you elaborate why it fails for you, are you doing something similar to #7220 |
@laurit, we are using a |
done 👍
it seems more precise to only carry over the context class loader from registration to execution, but I could easily be convinced otherwise
added tests for these (they are covered by the same underlying change) 👍
|
I don't have a strong opinion (in fact it's so weak it's barely there), I'd be fine with merging this and waiting for further bug reports. |
Wondering if there's any reason not to do this?
The test is not very realistic. The problem is that the agent's thread context class loader appears to be ClassLoader.getSystemClassLoader(), which works in simple unit tests where the app is also in the system class loader. Maybe a smoke test (in an app server with nested class loaders) would be better?