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

Integrate with servlet filter #13

Open
pavolloffay opened this issue Feb 20, 2017 · 7 comments
Open

Integrate with servlet filter #13

pavolloffay opened this issue Feb 20, 2017 · 7 comments

Comments

@pavolloffay
Copy link
Collaborator

pavolloffay commented Feb 20, 2017

Jax-rs instrumentation cannot trace all request:

  • no URL mapping
  • unauthenticated requests

I propose to use servlet filter in conjunction with jax-rs filters. However, jax-rs filters should work alone too, but when there is a span created in filter it should be respected.

@hypnoce
Copy link
Contributor

hypnoce commented Oct 29, 2017

@pavolloffay, for the first point, does adding the @PreMatching so that the filter is called before any attempt to match the URL would work ?

@pavolloffay
Copy link
Collaborator Author

@hypnoce I don't know. It probably could work.

If I understand it correctly by default jaxrs filters are executed at post-match request extension point. And priority [2] defines the order for each extension point.

https://docs.oracle.com/javaee/7/api/javax/ws/rs/Priorities.html

[1] https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/ContainerRequestFilter.html
[2] https://docs.oracle.com/javaee/7/api/javax/ws/rs/Priorities.html
[3] preMatch: https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/PreMatching.html

This was referenced Nov 14, 2017
@tmszdmsk
Copy link
Contributor

Recently when I was working on Opentracing in Dropwizard project I noticed that jaxrs and servlet integrations do not play well together, i.e. jaxrs-integration spans are not children of servlet-integration created spans. Maybe original idea was that you should have only one of them installed but not all endpoints have to be handled by jaxrs so it is beneficial to have both.

My idea would be to modify jaxrs integration in such a way that:

  • if there is active span (presumably created by servlet integration), don't extract span information from request headers
  • if there is no active span - proceed as it is now.

I can work on it in my spare time, but the question is: does it make sense for you?

@hypnoce
Copy link
Contributor

hypnoce commented Jan 31, 2018

From my perspective I do not see anything that can go wrong. They should play well together.
Nevertheless this issue is still valid in the context of a standalone jaxrs instrumentation.

@pavolloffay
Copy link
Collaborator Author

@tmszdmsk There is one problem. This instrumentation supports @Traced(false) defined on the jax-rs endpoint. If the span is created in webfilter there is no way how to "cancel" it in the jaxrs layer.

@tmszdmsk
Copy link
Contributor

@pavolloffay Shouldn't it be a concern of servlet filter and the developer who is using it? It won't enable servlet filter OOTB, my solution just improves coexistence of two integrations.

@tmszdmsk
Copy link
Contributor

But, as @hypnoce said, it is a different issue than originally reported. I will create a separate ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants