-
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
Fix client scope not being closed #82
Fix client scope not being closed #82
Conversation
👍 |
You are right, I thought that exception is thrown before the request filter, but it's not. So this is a much better option. |
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.
LGTM - only a couple of minor things and a question.
@@ -2,6 +2,7 @@ | |||
|
|||
import static io.opentracing.contrib.jaxrs2.internal.SpanWrapper.PROPERTY_NAME; | |||
|
|||
import io.opentracing.Scope; |
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.
Doesn't look like this is needed.
@@ -61,7 +62,7 @@ public void filter(ClientRequestContext requestContext) throws IOException { | |||
.asChildOf(parentSpanContext); | |||
} | |||
|
|||
Span span = spanBuilder.startActive(false).span(); | |||
Span span = spanBuilder.start(); |
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.
Based on the previous comments on the PR - what happens if an exception is thrown? If the scope wouldn't be closed, this also means the span is not finished?
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, there is an issue for it and TODO in the test
@@ -56,14 +65,15 @@ protected void initTracing(ServletContextHandler context) { | |||
public void testDefaultConfiguration() { | |||
MockTracer mockTracer = new MockTracer(new ThreadLocalScopeManager(), Propagator.TEXT_MAP); |
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.
Not related to this PR, but could simplify this to just use default constructor.
Fixes #78
There are two solutions:
cc @mabn