Class: OpenTelemetry::SDK::Trace::Export::SpanExporter

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

Overview

SpanExporter describes a duck type. It is not required to subclass this class to provide an implementation of SpanExporter, provided the interface is satisfied. SpanExporter allows different tracing services to export recorded data for sampled spans in their own format.

To export data an exporter MUST be registered to the TracerProvider using a SpanProcessor implementation.

Instance Method Summary collapse

Constructor Details

#initializeSpanExporter

Returns a new instance of SpanExporter.



19
20
21
# File 'lib/opentelemetry/sdk/trace/export/span_exporter.rb', line 19

def initialize
  @stopped = false
end

Instance Method Details

#export(span_data, timeout: nil) ⇒ Integer

Called to export sampled SpanDatas.

Parameters:

  • span_data (Enumerable<SpanData>)

    the list of sampled SpanData to be exported.

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

    An optional timeout in seconds.

Returns:

  • (Integer)

    the result of the export.



29
30
31
32
33
# File 'lib/opentelemetry/sdk/trace/export/span_exporter.rb', line 29

def export(span_data, timeout: nil)
  return SUCCESS unless @stopped

  FAILURE
end

#force_flush(timeout: nil) ⇒ Integer

Called when TracerProvider#force_flush is called, if this exporter is registered to a TracerProvider object.

Parameters:

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

    An optional timeout in seconds.

Returns:

  • (Integer)

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



41
42
43
# File 'lib/opentelemetry/sdk/trace/export/span_exporter.rb', line 41

def force_flush(timeout: nil)
  SUCCESS
end

#shutdown(timeout: nil) ⇒ Object

Called when TracerProvider#shutdown is called, if this exporter is registered to a TracerProvider object.

Parameters:

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

    An optional timeout in seconds.



49
50
51
52
# File 'lib/opentelemetry/sdk/trace/export/span_exporter.rb', line 49

def shutdown(timeout: nil)
  @stopped = true
  SUCCESS
end