Class: OpenTelemetry::SDK::Trace::Export::NoopSpanExporter

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

Overview

A noop exporter that demonstrates and documents the SpanExporter duck type. 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 SimpleSpanProcessor or a BatchSpanProcessor.

Instance Method Summary collapse

Constructor Details

#initializeNoopSpanExporter

Returns a new instance of NoopSpanExporter.



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

def initialize
  @stopped = false
end

Instance Method Details

#export(spans, timeout: nil) ⇒ Integer

Called to export sampled Spans.

Parameters:

  • spans (Enumerable<Span>)

    the list of sampled Spans to be exported.

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

    An optional timeout in seconds.

Returns:

  • (Integer)

    the result of the export.



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

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

  FAILURE
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.



38
39
40
41
# File 'lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb', line 38

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