Class: AppPerfRpm::Tracing::ManagedTracer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/app_perf_rpm/tracing/managed_tracer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tracer, thread_span_stack = ThreadSpanStack.new) ⇒ ManagedTracer

Returns a new instance of ManagedTracer.



11
12
13
14
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 11

def initialize(tracer, thread_span_stack = ThreadSpanStack.new)
  @tracer = tracer
  @thread_span_stack = thread_span_stack
end

Instance Attribute Details

#thread_span_stackObject (readonly)

Returns the value of attribute thread_span_stack.



9
10
11
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 9

def thread_span_stack
  @thread_span_stack
end

Instance Method Details

#active_spanObject



24
25
26
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 24

def active_span
  thread_span_stack.active_span
end

#collectorObject



20
21
22
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 20

def collector
  @tracer.collector
end

#start_span(operation_name, opts = {}, *args) ⇒ Object



28
29
30
31
32
33
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 28

def start_span(operation_name, opts = {}, *args)
  opts[:child_of] ||= active_span

  span = @tracer.start_span(operation_name, opts, *args)
  @thread_span_stack.set_active_span(span)
end

#wrappedObject



16
17
18
# File 'lib/app_perf_rpm/tracing/managed_tracer.rb', line 16

def wrapped
  @tracer
end