Sha256: 8edffab16a7a5ae3ee3f736cb54b3df018a781855b62a74d7a9a36e5661ea46c

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module SDK
    module Trace
      module Export
        # 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 {TracerFactory} using
        # a {SimpleSpanProcessor} or a {BatchSpanProcessor}.
        class NoopSpanExporter
          def initialize
            @stopped = false
          end

          # Called to export sampled {Span}s.
          #
          # @param [Enumerable<Span>] spans the list of sampled {Span}s to be
          #   exported.
          # @return [Integer] the result of the export.
          def export(spans)
            return SUCCESS unless @stopped

            FAILED_NOT_RETRYABLE
          end

          # Called when {TracerFactory#shutdown} is called, if this exporter is
          # registered to a {TracerFactory} object.
          def shutdown
            @stopped = true
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.2.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb