-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix tomcat async spans #4339
Fix tomcat async spans #4339
Conversation
@trask Just curious does this have anything to do with the strict context stuff we talked about? |
return null; | ||
})); | ||
ctx -> { | ||
HttpServerTest.controller(QUERY_PARAM, () -> null); |
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.
WDYT about removing the second argument of controller
? The passed lambda seems to be unneeded now
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.
it's still needed in some cases. i'm not super convinced about changing the structure of the controllers the way I did, since the existing structure probably mimic'd user code better. so i reverted those changes, and just suppressed the test in more places for now short of a better idea
@@ -32,7 +33,9 @@ public boolean shouldStart(Context parentContext, Request request) { | |||
} | |||
|
|||
public Context start(Context parentContext, Request request) { | |||
return instrumenter.start(parentContext, request); | |||
Context context = instrumenter.start(parentContext, request); | |||
request.setAttribute(HttpServerTracer.CONTEXT_ATTRIBUTE, context); |
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.
Is this the actual fix?
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.
It should be. The problem is in
Line 101 in 8066f27
Context context = getServerContext(request); |
HttpServletRequest
implementation on tomcat stores attributes on the underlying coyote request. The only other server that does not use servlet api based instrumenter is undertow where request is always ended from a callback and presumably doesn't need special handling for async requests.I guess alternatively we could add a field to
AppServerBridge
to carry context and in ServletHelper
try both AppServerBridge
and request attribute.
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.
this would be nice if it leads to unifying app server behavior a bit, I created #4347 to revisit the idea
there's definitely overlap, the new test points out places where the server span can end before the controller span IIRC one option we discussed previously was introducing some mechanism to delay the span end until the active scope was closed |
* Add test * Fix tomcat async spans * Preserve existing test controller behavior * Comments
Resolves #4334
Adds test for all server instrumentation to verify that server spans end after all of their child spans (with a couple of exceptions).