-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add proper support for a single RequestTracingFilter that supports Servlet 2.x and Servlet 3 environments at the same time #52
Add proper support for a single RequestTracingFilter that supports Servlet 2.x and Servlet 3 environments at the same time #52
Conversation
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
============================================
+ Coverage 98.93% 98.94% +<.01%
+ Complexity 475 471 -4
============================================
Files 28 28
Lines 1132 1139 +7
Branches 134 133 -1
============================================
+ Hits 1120 1127 +7
Misses 4 4
Partials 8 8
Continue to review full report at Codecov.
|
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.
Wonderful
public static void beforeClass() throws Exception { | ||
try { | ||
ServletRequest.class.getMethod("getAsyncContext"); |
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.
Smart
wingtips-servlet-api/README.md
Outdated
this module might need to do this. Which Servlet API dependency you pull in depends on the type of Servlet environment | ||
you want to support (Servlet 2.x or Servlet 3+). For example: | ||
|
||
* Servlet 3 API dependency: [`javax.servlet:javax.servlet-api:$servlet3ApiVersion`](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22javax.servlet%22%20AND%20a%3A%22javax.servlet-api%22) |
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.
Variables intentional?
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.
Yes, but I can see how it looks like a copy/paste error. I'll see if I can clear it up.
* @param servletRequestClass ServletRequest implementation class | ||
* @return true if the given servletRequest implementation class supports the getAsyncContext() method, | ||
* otherwise false | ||
* <p>If you want to prevent this filter from executing on specific requests then you can override {@link |
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.
Neat.. good idea to document this
// Make sure we set the trace ID on the response header now before the response is committed (if we wait | ||
// until after the filter chain then the response might already be committed, silently preventing us | ||
// from setting the response header) | ||
response.setHeader(TraceHeaders.TRACE_ID, newSpan.getTraceId()); |
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.
Ps eventhough b3 doesnt usually do this, I noticed amazon do. For example returning back the sample result (as everything is in one header)
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.
Yeah I still have issue #30 to change this to have the response header be something other than X-B3-TraceId
, but having the trace ID somewhere in the response headers has been critically useful.
…rvlet 2.x and Servlet 3 environments at the same time
5021065
to
d2a4d70
Compare
Fixes issue #50. Big thanks to @adriancole and @woldie for the help on this.