Class: OpenTelemetry::SDK::Trace::SpanProcessor

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

Overview

SpanProcessor describes a duck type and provides synchronous no-op hooks for when a Span is started or when a Span is ended. It is not required to subclass this class to provide an implementation of SpanProcessor, provided the interface is satisfied.

Instance Method Summary collapse

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.

Parameters:

  • timeout (optional Numeric) (defaults to: nil)

    An optional timeout in seconds.

Returns:

  • (Integer)

    Export::SUCCESS if no error occurred, Export::FAILURE if a non-specific failure occurred, Export::TIMEOUT if a timeout occurred.



46
47
48
# File 'lib/opentelemetry/sdk/trace/span_processor.rb', line 46

def force_flush(timeout: nil)
  Export::SUCCESS
end

#on_finish(span) ⇒ Object

Called when a OpenTelemetry::SDK::Trace::Span is ended, if the OpenTelemetry::SDK::Trace::Span#recording? returns true.

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

Parameters:



33
# File 'lib/opentelemetry/sdk/trace/span_processor.rb', line 33

def on_finish(span); end

#on_start(span, parent_context) ⇒ Object

Called when a OpenTelemetry::SDK::Trace::Span is started, if the OpenTelemetry::SDK::Trace::Span#recording? returns true.

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

Parameters:



24
# File 'lib/opentelemetry/sdk/trace/span_processor.rb', line 24

def on_start(span, parent_context); end

#shutdown(timeout: nil) ⇒ Integer

Called when TracerProvider#shutdown is called.

Parameters:

  • timeout (optional Numeric) (defaults to: nil)

    An optional timeout in seconds.

Returns:

  • (Integer)

    Export::SUCCESS if no error occurred, Export::FAILURE if a non-specific failure occurred, Export::TIMEOUT if a timeout occurred.



55
56
57
# File 'lib/opentelemetry/sdk/trace/span_processor.rb', line 55

def shutdown(timeout: nil)
  Export::SUCCESS
end