Class: OpenTelemetry::SDK::Trace::MultiSpanProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/trace/multi_span_processor.rb

Overview

Implementation of the SpanProcessor duck type that simply forwards all received events to a list of SpanProcessors.

Instance Method Summary collapse

Constructor Details

#initialize(span_processors) ⇒ MultiSpanProcessor

Parameters:

  • span_processors (Enumerable<SpanProcessor>)

    a collection of SpanProcessors.



18
19
20
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 18

def initialize(span_processors)
  @span_processors = span_processors.to_a.freeze
end

Instance Method Details

#on_finish(span) ⇒ Object

Called when a Span is ended, if the Span#recording? returns true.

This method is called synchronously on the execution thread, should not throw or block the execution thread.

Parameters:

  • span (Span)

    the Span that just ended.



40
41
42
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 40

def on_finish(span)
  @span_processors.each { |processor| processor.on_finish(span) }
end

#on_start(span) ⇒ Object

Called when a Span is started, if the Span#recording? returns true.

This method is called synchronously on the execution thread, should not throw or block the execution thread.

Parameters:

  • span (Span)

    the Span that just started.



29
30
31
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 29

def on_start(span)
  @span_processors.each { |processor| processor.on_start(span) }
end

#shutdownObject

Called when TracerFactory#shutdown is called.



45
46
47
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 45

def shutdown
  @span_processors.each(&:shutdown)
end