Class: Jaeger::ScopeManager
- Inherits:
-
Object
- Object
- Jaeger::ScopeManager
- Defined in:
- lib/jaeger/scope_manager.rb,
lib/jaeger/scope_manager/scope_stack.rb,
lib/jaeger/scope_manager/scope_identifier.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
Defined Under Namespace
Classes: ScopeIdentifier, ScopeStack
Instance Method Summary collapse
-
#activate(span, finish_on_close: true) ⇒ Scope
Make a span instance active.
-
#active ⇒ Scope
Return active scope.
-
#initialize ⇒ ScopeManager
constructor
A new instance of ScopeManager.
Constructor Details
#initialize ⇒ ScopeManager
Returns a new instance of ScopeManager.
16 17 18 |
# File 'lib/jaeger/scope_manager.rb', line 16 def initialize @scope_stack = ScopeStack.new end |
Instance Method Details
#activate(span, finish_on_close: true) ⇒ Scope
Make a span instance active
28 29 30 31 32 33 |
# File 'lib/jaeger/scope_manager.rb', line 28 def activate(span, finish_on_close: true) return active if active && active.span == span scope = Scope.new(span, @scope_stack, finish_on_close: finish_on_close) @scope_stack.push(scope) scope end |
#active ⇒ Scope
Return active scope
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.
43 44 45 |
# File 'lib/jaeger/scope_manager.rb', line 43 def active @scope_stack.peek end |