Skip to content

[OpenTracing] Scope and ScopeManager implementation#473

Merged
delner merged 2 commits into
feature/opentracingfrom
feature/opentracing_scope_and_scope_manager
Jun 25, 2018
Merged

[OpenTracing] Scope and ScopeManager implementation#473
delner merged 2 commits into
feature/opentracingfrom
feature/opentracing_scope_and_scope_manager

Conversation

@delner

@delner delner commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

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)

@delner delner Jun 25, 2018

Copy link
Copy Markdown
Contributor Author

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.

@Kyle-Verhoog Kyle-Verhoog left a comment

Copy link
Copy Markdown
Member

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 this pull request 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