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 OpenTracing 0.33. #353

Closed
wants to merge 0 commits into from
Closed

Conversation

radcortez
Copy link
Member

No description provided.

@radcortez
Copy link
Member Author

@Ladicek we will need this for the MP 4.0 update.

activeScope.close();
Span span = scopeManager.activeSpan();
if (span != null) {
scopeManager.activate(span).close();
Copy link
Contributor

Choose a reason for hiding this comment

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

So this line is effectively a noop. It creates a new scope and immediately destroys it, which leads to restoring the previously active scope (if there was one). Looks like the new OpenTracing API doesn't let us do what ConProp requires :-/

Copy link
Contributor

Choose a reason for hiding this comment

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

... which is temporarily suspending the current span. That would be done by closing the currently active scope (and later activating the span again, which would create a new scope; we currently don't do this as highlighted by the TODO below). But we can't get to the currently active scope anymore.

Copy link
Contributor

@Ladicek Ladicek Jan 13, 2021

Choose a reason for hiding this comment

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

This actually seems to be a deliberate decision by OpenTracing to prevent API misuse. Which makes advanced use cases, like context propagation, impossible :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose the OpenTracing API is meant to be used in a way that there is no currently active scope (and hence no currently active span) by the time context propagation happens. Which essentially means that this method should be a real noop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure on this one, might be good to see if @pavolloffay can offer advice

Copy link
Member Author

Choose a reason for hiding this comment

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

From the java doc:

    /**
     * @deprecated use {@link #activeSpan()} instead.
     * Return the currently active {@link Scope} which can be used to deactivate the currently active
     * {@link Span}.
     *
     * <p>
     * Observe that {@link Scope} is expected to be used only in the same thread where it was
     * created, and thus should not be passed across threads.
     *
     * <p>
     * Because both {@link #active()} and {@link #activeSpan()} reference the current
     * active state, they both will be either null or non-null.
     *
     * @return the {@link Scope active scope}, or null if none could be found.
     */

Copy link
Member Author

Choose a reason for hiding this comment

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

My interpretation is that it doesn't necessarily create a new span. The implementation seems equivalent, but I'm no expert here :)

Copy link
Contributor

Choose a reason for hiding this comment

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

That javadoc is for ScopeManager.active() and comes from 0.32, right? Because that method is gone in 0.33.

ScopeManager.activate(Span) creates a new scope. The javadoc for Span and Scope could be clearer, but my understanding is that scope is a slice of time during which you do something with the span. During the lifetime of a span, many scopes can be created and subsequently closed, but the span itself can only be closed once.

Copy link
Member Author

Choose a reason for hiding this comment

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

That javadoc is for ScopeManager.active() and comes from 0.32, right? Because that method is gone in 0.33.

Yes, it is.

@Ladicek
Copy link
Contributor

Ladicek commented Jan 14, 2021

Hmm, I wanted to force-push the commit I amended locally, but somehow failed. Sorry about that, will open a new PR from my branch :-)

@Ladicek
Copy link
Contributor

Ladicek commented Jan 14, 2021

Ha, I know what happened, instead of pushing the commit, I accidentally pushed the master branch, and GitHub correctly figured out that there's nothing to merge, so it closed the PR, and now I can't push the commit to the branch, because it doesn't belong to a PR :-)

@Ladicek
Copy link
Contributor

Ladicek commented Jan 14, 2021

Submitted #360.

@radcortez radcortez deleted the master branch March 22, 2021 14:29
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