Class: Datadog::OpenTelemetry::SDK::SpanProcessor
- Inherits:
-
Object
- Object
- Datadog::OpenTelemetry::SDK::SpanProcessor
- Defined in:
- lib/datadog/opentelemetry/sdk/span_processor.rb
Overview
Keeps OpenTelemetry spans in sync with the Datadog execution context. Also responsible for flushing spans when their are finished.
Instance Method Summary collapse
-
#force_flush(timeout: nil) ⇒ Integer
Export all ended spans to the configured ‘Exporter` that have not yet been exported.
-
#on_finish(span) ⇒ Object
Called when a Span is ended, if the Span#recording? returns true.
-
#on_start(span, parent_context) ⇒ Object
Called when a Span is started, if the Span#recording? returns true.
-
#shutdown(timeout: nil) ⇒ Integer
Called when TracerProvider#shutdown is called.
Instance Method Details
#force_flush(timeout: nil) ⇒ Integer
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.
46 47 48 49 |
# File 'lib/datadog/opentelemetry/sdk/span_processor.rb', line 46 def force_flush(timeout: nil) writer.force_flush(timeout: timeout) if writer.respond_to? :force_flush Export::SUCCESS 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.
31 32 33 |
# File 'lib/datadog/opentelemetry/sdk/span_processor.rb', line 31 def on_finish(span) span.datadog_span.finish(ns_to_time(span.)) end |
#on_start(span, parent_context) ⇒ 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.
20 21 22 |
# File 'lib/datadog/opentelemetry/sdk/span_processor.rb', line 20 def on_start(span, parent_context) create_matching_datadog_span(span, parent_context) end |
#shutdown(timeout: nil) ⇒ Integer
Called when TracerProvider#shutdown is called.
56 57 58 59 |
# File 'lib/datadog/opentelemetry/sdk/span_processor.rb', line 56 def shutdown(timeout: nil) writer.stop Export::SUCCESS end |