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

[OpenTracing] Scope and ScopeManager implementation #473

Merged

Conversation

delner
Copy link
Contributor

@delner delner commented Jun 22, 2018

This pull request implements Scope and ScopeManager. It's more or less based off what was done in opentracing/opentracing-python#77 for consistency.

@delner delner added core Involves Datadog core libraries feature Involves a product feature labels Jun 22, 2018
@delner delner self-assigned this Jun 22, 2018
def close
return unless equal?(manager.active)
span.finish if finish_on_close
manager.send(:set_scope, @previous_scope)
Copy link
Contributor Author

@delner delner Jun 25, 2018

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.

Copy link
Member

@Kyle-Verhoog Kyle-Verhoog left a 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. 👍

@delner delner merged commit f39573a into feature/opentracing Jun 25, 2018
delner added a commit that referenced this pull request Jul 10, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
delner added a commit that referenced this pull request Jul 16, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
delner added a commit that referenced this pull request Jul 17, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
delner added a commit that referenced this pull request Aug 9, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
@delner delner deleted the feature/opentracing_scope_and_scope_manager branch August 14, 2018 17:43
delner added a commit that referenced this pull request Aug 17, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
@delner delner added this to the 0.16.0 milestone Aug 23, 2018
delner added a commit that referenced this pull request Sep 13, 2018
* Changed: Scope to expect Span and ScopeManager.

* Added: Datadog::OpenTracer::ThreadLocalScope and Manager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries feature Involves a product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants