Class: LightStep::ScopeManager
- Inherits:
-
Object
- Object
- LightStep::ScopeManager
- Defined in:
- lib/lightstep/scope_manager.rb
Overview
ScopeManager represents an OpenTracing ScopeManager
See www.opentracing.io for more information.
The ScopeManager interface abstracts both the activation of Span instances via ScopeManager#activate and access to an active Span/Scope via ScopeManager#active
Instance Method Summary collapse
-
#activate(span:, finish_on_close: true) ⇒ Scope
Make a span instance active.
-
#active ⇒ Scope
currently active Span.
- #deactivate ⇒ Object
Instance Method Details
#activate(span:, finish_on_close: true) ⇒ Scope
Make a span instance active.
19 20 21 22 23 24 |
# File 'lib/lightstep/scope_manager.rb', line 19 def activate(span:, finish_on_close: true) return active if active && active.span == span LightStep::Scope.new(manager: self, span: span, finish_on_close: finish_on_close).tap do |scope| add_scope(scope) end end |
#active ⇒ Scope
currently active Span.
If there is a non-null Scope, its wrapped Span becomes an implicit parent (as Reference#CHILD_OF) of any newly-created Span at Tracer#start_active_span or Tracer#start_span time.
32 33 34 |
# File 'lib/lightstep/scope_manager.rb', line 32 def active scopes.last end |
#deactivate ⇒ Object
36 37 38 |
# File 'lib/lightstep/scope_manager.rb', line 36 def deactivate scopes.pop end |