Class: LightStep::Scope
- Inherits:
-
Object
- Object
- LightStep::Scope
- Defined in:
- lib/lightstep/scope.rb
Overview
Scope represents an OpenTracing Scope
See www.opentracing.io for more information.
Instance Attribute Summary collapse
-
#span ⇒ Object
readonly
Returns the value of attribute span.
Instance Method Summary collapse
-
#close ⇒ Object
Mark the end of the active period for the current thread and Scope, updating the ScopeManager#active in the process.
-
#initialize(manager:, span:, finish_on_close: true) ⇒ Scope
constructor
A new instance of Scope.
Constructor Details
#initialize(manager:, span:, finish_on_close: true) ⇒ Scope
Returns a new instance of Scope.
8 9 10 11 12 |
# File 'lib/lightstep/scope.rb', line 8 def initialize(manager:, span:, finish_on_close: true) @manager = manager @span = span @finish_on_close = finish_on_close end |
Instance Attribute Details
#span ⇒ Object (readonly)
Returns the value of attribute span.
6 7 8 |
# File 'lib/lightstep/scope.rb', line 6 def span @span end |
Instance Method Details
#close ⇒ Object
Mark the end of the active period for the current thread and Scope, updating the ScopeManager#active in the process.
16 17 18 19 20 21 |
# File 'lib/lightstep/scope.rb', line 16 def close raise(LightStep::Error, 'already closed') if @closed @closed = true @span.finish if @finish_on_close @manager.deactivate end |