-
Notifications
You must be signed in to change notification settings - Fork 860
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
Unable to access the original Runnable object in SpringSchedulingRunnableWrapper #8661
Comments
@kes2464 could you elaborate how do you observe our wrapped runnable or provide a sample app that reproduces the issue. |
Hi @laurit, I have my own implementation of TaskScheduler which implements schedule methods. So it's something like this
Basically, when it’s auto-instrumented the Runnable is wrapped to SpringSchedulingRunnableWrapper before entering the method, it never goes into the if block. |
@kes2464 if your scheduler delegates to another scheduler that is one of the instrumented ones then that scheduler will produce spans. If not, then yes, you'll need to manually instrument it. |
Sounds good, thanks. |
Opening a bug. Could this be looked into?
Thanks
Discussed in #8657
Originally posted by kes2464 June 6, 2023
Hi
One of my applications have the above code which checks a type of Runnable instance and does something.
It's scheduled through Spring Task scheduler, so it's auto-instrumented.
opentelemetry-java-instrumentation/instrumentation/spring/spring-scheduling-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/TaskSchedulerInstrumentation.java
Lines 47 to 52 in a2fd908
However, TaskSchedulerInstrumentation wraps the object and replaces the argument, so the condition is never true.
There's also no getter of the original instance in the wrapper.
Is there any common practice/workaround that people use apart from using reflection?
The text was updated successfully, but these errors were encountered: