class SplunkTracing::Scope

Scope represents an OpenTracing Scope

See www.opentracing.io for more information.

Attributes

span[R]

Public Class Methods

new(manager:, span:, finish_on_close: true) click to toggle source
# File lib/splunktracing/scope.rb, line 8
def initialize(manager:, span:, finish_on_close: true)
  @manager = manager
  @span = span
  @finish_on_close = finish_on_close
end

Public Instance Methods

close() click to toggle source

Mark the end of the active period for the current thread and Scope, updating the ScopeManager#active in the process.

# File lib/splunktracing/scope.rb, line 16
def close
  raise(SplunkTracing::Error, 'already closed') if @closed
  @closed = true
  @span.finish if @finish_on_close
  @manager.deactivate
end