You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've encountered an issue that @Traced annotation doesn't work for JAX-RS resources on class level when using CDI with Jersey application.
The reason for this lies in Weld-made proxies which strip the class level annotations from the bean instance and therefore are not passed to the ResourceInfo via .getResourceClass() method.
Actually if you use CDI in your code the only reason why the tracing for JAX-RS REST resources works at all is because the @Traced annotation is always null and by default if withTraceNothing() is not set in ServerTracingDynamicFeature builder it acts as if tracing is enabled for all resource calls.
If withTraceNothing() is set in the ServerTracingDynamicFeature builder then it doesn't matter whether you add the annotation to the class level or not it will always be null. This isn't true for .getResourceMethod() which keeps the annotations correctly.
I've solved this with extending the ServerTracingDynamicFeature and overriding the closestTracingAnnotation(ResourceInfo resourceInfo) method like so:
Hi,
I've encountered an issue that @Traced annotation doesn't work for JAX-RS resources on class level when using CDI with Jersey application.
The reason for this lies in Weld-made proxies which strip the class level annotations from the bean instance and therefore are not passed to the ResourceInfo via .getResourceClass() method.
Actually if you use CDI in your code the only reason why the tracing for JAX-RS REST resources works at all is because the @Traced annotation is always null and by default if withTraceNothing() is not set in ServerTracingDynamicFeature builder it acts as if tracing is enabled for all resource calls.
If withTraceNothing() is set in the ServerTracingDynamicFeature builder then it doesn't matter whether you add the annotation to the class level or not it will always be null. This isn't true for .getResourceMethod() which keeps the annotations correctly.
I've solved this with extending the ServerTracingDynamicFeature and overriding the closestTracingAnnotation(ResourceInfo resourceInfo) method like so:
This seems cumbersome to me. Please let me know if there is a possible fix for this.
Thank you for your reply and with kind regards,
Anna
The text was updated successfully, but these errors were encountered: