Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
make servlet3 + spring webmvc + jaxrs 2.0 indy compatible #12432
base: main
Are you sure you want to change the base?
make servlet3 + spring webmvc + jaxrs 2.0 indy compatible #12432
Changes from 17 commits
c73f5c6
59f857e
7a0993d
e6e4f7a
37970e8
cdd978c
30f5356
4e6ce38
dba9e7b
dbbbdea
b043e83
99d8bff
0c91cbc
5b3b408
d2714ad
978ce81
8740eff
43ddd93
da8d9bc
affe804
54a9f00
a7f57cf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[for reviewer] this is an edge-case where the inlined advice will be able to directly call the
OpenTelemetryHandlerMappingFilter
class directly and with indy we get a proxy instance that needs to be unwrapped (thus thedelegate
fields needs to be made public for simplicity).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to add a TODO here to drop this branch when we remove support for inlined advice then maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[for reviewer] this is an edge-case where the inlined advice will be able to directly call the
OpenTelemetryHandlerMappingFilter
class directly and with indy we get a proxy instance that needs to be unwrapped (thus thedelegate
fields needs to be made public for simplicity).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo instead of doing the reflection here there should be an API to do this. Something that would unwrap the object when it is proxy and return the input when it is not. So you could write
OpenTelemetryHandlerMappingFilter filter = = (OpenTelemetryHandlerMappingFilter) unwrap(springCtx.getBean("otelAutoDispatcherFilter"));
I guess using the reflection as currently is fine for start. Instead of making the delegate field public I'd probably try to make the proxy instance implement an interface that allow unwrapping. If needed that interface could be hidden from reflection
opentelemetry-java-instrumentation/instrumentation/internal/internal-reflection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/reflection/ReflectionHelper.java
Line 59 in 647fc45