-
Notifications
You must be signed in to change notification settings - Fork 33
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
Priority of ServerTracingFilter #133
Comments
The priority can be specified in the builder https://github.com/opentracing-contrib/java-jaxrs/blob/master/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerTracingDynamicFeature.java#L160. The question is whether we should change the default priority. There is some prior art when people requested using header decorator #15 |
Thank you, that sounds about right. I spent some time looking for other "tracing" filters in github and found a few opinions on this, Integer.MIN_VALUE (and +10), 0, or a custom constant with before authentication filter. Apache Geronimo was using HEADER_DECORATOR. Brave looked like this: https://github.com/sapiokilias/t1/blob/101e8561f45d6308d8f9aaab47f3798a9fd54db6/instrumentation/jaxrs2/src/main/java/brave/jaxrs2/TracingContainerFilter.java#L33 This is the github query I used: https://github.com/search?q=%22import+javax.annotation.Priority%3B%22+tracing+ContainerRequestFilter&type=Code I believe HEADER_DECORATOR should be used to set response headers for caching, csrf, security, etc. What I wasn't able to find was any opinionated documentation to that effect. Having that kind of an opinion as it pertains to tracing would be something I could imagine coming out of the opentracing spec. I'm also picking at nats here 😄 but I think the default behavior would be improved with a default priority that runs before Priorities.AUTHENTICATION. |
@johnament was there any specific reason why tracing filter runs with priority |
The current priority of ServerTracingFilter is set at
Priorities.HEADER_DECORATOR
.I don't think that is right for this library. I'm expecting this library to initialize tracing for a request and that should happen very early in the request. My expectation is that the entire request is instrumented including Authentication and Authorization filters.
Where this should fit is a little fuzzy,
ContainerRequestFilter
implementations that don't fit the mold injavax.ws.rs.Priorities
were usingInteger.MIN_VALUE
. (I just looked at library implementations on my classpath), that included org.glassfish.jersey.logging.ServerLoggingFilter and another logging filter in a less common library.Assuming no one will ever need to run before you is a little rude so I'd propose a priority of
-1000
. This is before most application code and all ofjavax.ws.rs.Priorities
, I propose a number below 0 because application code I've seen commonly uses 0 to mean me first.The text was updated successfully, but these errors were encountered: