Class: OpenTelemetry::SDK::Trace::MultiSpanProcessor
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Trace::MultiSpanProcessor
- 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
-
#force_flush ⇒ Object
Export all ended spans to the configured
Exporterthat have not yet been exported. -
#initialize(span_processors) ⇒ MultiSpanProcessor
constructor
Creates a new MultiSpanProcessor.
-
#on_finish(span) ⇒ Object
Called when a Span is ended, if the Span#recording? returns true.
-
#on_start(span) ⇒ Object
Called when a Span is started, if the Span#recording? returns true.
-
#shutdown ⇒ Object
Called when TracerProvider#shutdown is called.
Constructor Details
#initialize(span_processors) ⇒ MultiSpanProcessor
Creates a new OpenTelemetry::SDK::Trace::MultiSpanProcessor.
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
#force_flush ⇒ Object
Export all ended spans to the configured Exporter that have not yet
been exported.
This method should only be called in cases where it is absolutely
necessary, such as when using some FaaS providers that may suspend
the process after an invocation, but before the Processor exports
the completed spans.
51 52 53 |
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 51 def force_flush @span_processors.each(&:force_flush) end |
#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.
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.
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 |
#shutdown ⇒ Object
Called when TracerProvider#shutdown is called.
56 57 58 |
# File 'lib/opentelemetry/sdk/trace/multi_span_processor.rb', line 56 def shutdown @span_processors.each(&:shutdown) end |