Sha256: 004c66b443977e6c76a759b2401858d6775ac7dfdfdcd288c046b0cbb940351f

Contents?: true

Size: 1.93 KB

Versions: 16

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module SDK
    module Trace
      module Export
        # 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.
        class SpanExporter
          def initialize
            @stopped = false
          end

          # Called to export sampled {SpanData}s.
          #
          # @param [Enumerable<SpanData>] span_data the list of sampled {SpanData} to be
          #   exported.
          # @param [optional Numeric] timeout An optional timeout in seconds.
          # @return [Integer] the result of the export.
          def export(span_data, timeout: nil)
            return SUCCESS unless @stopped

            FAILURE
          end

          # Called when {TracerProvider#force_flush} is called, if this exporter is
          # registered to a {TracerProvider} object.
          #
          # @param [optional Numeric] timeout An optional timeout in seconds.
          # @return [Integer] SUCCESS if no error occurred, FAILURE if a
          #   non-specific failure occurred, TIMEOUT if a timeout occurred.
          def force_flush(timeout: nil)
            SUCCESS
          end

          # Called when {TracerProvider#shutdown} is called, if this exporter is
          # registered to a {TracerProvider} object.
          #
          # @param [optional Numeric] timeout An optional timeout in seconds.
          def shutdown(timeout: nil)
            @stopped = true
            SUCCESS
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
opentelemetry-sdk-1.6.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.5.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.4.1 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.4.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.3.2 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.3.1 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.3.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.2.1 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.2.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.1.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.3 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.2 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.1 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.0 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.0.rc3 lib/opentelemetry/sdk/trace/export/span_exporter.rb
opentelemetry-sdk-1.0.0.rc2 lib/opentelemetry/sdk/trace/export/span_exporter.rb