-
Notifications
You must be signed in to change notification settings - Fork 375
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
[OpenTracing] Scope and ScopeManager implementation #473
[OpenTracing] Scope and ScopeManager implementation #473
Conversation
def close | ||
return unless equal?(manager.active) | ||
span.finish if finish_on_close | ||
manager.send(:set_scope, @previous_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.
There's something pretty icky about this: calling a private method on another class is never desirable. But this more or less how Python was doing it, and we were trying to mirror that implementation.
Ideally, a scope manager would be asked to close
, then it would call down to this Scope#close
, not the other way around. But as the API is designed, there's some tight coupling between Scope
and ScopeManager
(as evidenced by the manager
in the constructor), so I don't know if this is possible.
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.
From what I can tell looks semantically equivalent to the python implementation. 👍
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
* Changed: Scope to expect Span and ScopeManager. * Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
This pull request implements Scope and ScopeManager. It's more or less based off what was done in opentracing/opentracing-python#77 for consistency.