-
Notifications
You must be signed in to change notification settings - Fork 56
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
Adds $closeSpanOnFinish as second parameter for activate #60
Comments
Because of 3010347 commit we have inverted so that Span finish is able to close Scope (thought I am personally not a fan of as we leak Scope concept to Spans). But current option name is misleading. Spans we finish, Scopes we close. So currently an option should be named something like Now that a Span has to be aware of a Scope in order to close it this might be problematic as inside of ScopeManager::activate() we accept Span interface which does not have any methods so that we can pass the scope to it. Ideally for me I would rather go back to concept of startActiveSpan() returning a Scope to not leak Scopes to Spans as it is done in other OT libs. But in order to keep everything as it is now you would also need to introduce a method in Span interface named something like |
If span is aware of the scope, then I think there was a mistake in the design. Java has finishOnClose ie "finish underlying span on scope close". I think this API needs that as well. |
…and makes the span not aware of the scope.
@ellisv @yurishkuro I opened a PR to address this issue: https://github.com/opentracing/opentracing-php/pull/61/files |
[#60] Changes the API for the In process context propagation
Closed by #61 |
Background
Tracer::startActiveSpan
starts and span that is captured in ascope
and one of theSpanOptions
allows you to determine whether theScope
will be closed when finishing the span by passing['close_span_on_finish' => true]
.Problem
For usability matters,
$closeSpanOnFinish
should allow you to be passed when doingScopeManager::activate
. Those cases occur when starting anSpan
not as an active one and in such a case it is impossible to pass a value forclose_span_on_finish
.Proposal
Changes
ScopeManager::activate(OpenTracingSpan $span)
intoScopeManager::activate(OpenTracingSpan $span, $closeSpanOnFinish)
so you can also decide to pass the$closeSpanOnFinish
when activating a span in aScope
.Java already does this: https://github.com/opentracing/opentracing-java/blob/master/opentracing-api/src/main/java/io/opentracing/ScopeManager.java#L36
Ping @yurishkuro @tedsuo @beberlei @ellisv
The text was updated successfully, but these errors were encountered: