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

Update to use the OT Java 0.31.0-RC1 API #27

Merged
merged 6 commits into from
Oct 9, 2017

Conversation

objectiser
Copy link
Contributor

@objectiser objectiser commented Sep 29, 2017

No description provided.

@@ -217,7 +217,9 @@ public void onStartAsync(AsyncEvent event) throws IOException {
}
});
}
span.deactivate();
if (!httpRequest.isAsyncStarted()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally tried using this in the startActive, but it doesn't return an appropriate value at that point - so the issue is that currently this parent scope is not closed. So this needs to be reported as feedback on the OT java API RC. A possible approach may be to have an overloaded close that allows the finishSpan to be specified at the close - for cases where the decision is unknown when the scope is started.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear - does this currently work by checking httpRequest.isAsyncStarted() and then closing the span?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should close the scope for sync and async. The thread no longer belongs to the request.

I suggest using finishOnClose = false when starting the span. Then in async callbacks use finishOnClose = true.

Here is the patch https://pastebin.com/JT67yUYH

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use the approach discussed - so when async/sync not know when the Scope is started - it starts with 'finishOnClose=false' and then explicitly closes the span associated with the Scope if turns out to be synchronous.

@@ -4,7 +4,7 @@

<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-web-servlet-filter-parent</artifactId>
<version>0.0.10-SNAPSHOT</version>
<version>0.1.0-RC1-SNAPSHOT</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought it might be worth bumping the minor version as there are breaking changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, perhaps we could merge it to v0.1.0-RC1 branch. (We have to include the modified publis.sh)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just a straight copy of the publish.sh from opentracing-java?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will raise a PR against the master, the current version of the script has to be modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok - although I've just added it to this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opentracing/opentracing-java#198

This change is missing in the script. Please add it once it's merged. Or we can add it as a separate PR to the master.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be left as it is. The version will be changed by release process.

}
throw ex;
} finally {
if (httpRequest.isAsyncStarted()) {
final ActiveSpan.Continuation cont = span.capture();
final Span cont = scope.span();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to define it here? What about passing the span directly to tracer.scopeManager().activate(cont)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope could be closed - which makes accessing the span potentially unpredicatable - I don't know if it is defined whether the span remains accessible after the scope is closed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the scope could be closed

Could you please explain it more? This scope is accessible only from this class.

https://github.com/pavolloffay/opentracing-java/blob/4ae4656919181255d70fc67e9ddacc12d94a77a2/opentracing-api/src/main/java/io/opentracing/Scope.java#L40

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there is nothing in the method that says Span is not accessible after close so will change.

@objectiser objectiser changed the base branch from master to v0.1.0 October 2, 2017 09:41
# and we want that branch to be master or v0.0.0. which has been checked before.
# But we also want to make sure that we build and release exactly the tagged version,
# so we verify that the remote branch is where our tag is.
git checkout -B v`release_version | sed 's/-RC[[:digit:]]\+//'`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be changed.

It should distinguish between master and version branch. Please update it with ot-java repo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it can be merged/released

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume you meant to just copy it from ot-java repo - if so, done 👍

@objectiser objectiser merged commit 74b7273 into opentracing-contrib:v0.1.0 Oct 9, 2017
@objectiser objectiser deleted the otjrc branch October 9, 2017 13:41
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

Successfully merging this pull request may close these issues.

3 participants