Sha256: 2a2dfcfab64cb2fa6ebdbfcdd2d796ce56081e830830138598004b5e9edba859

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

# Copyright The 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 {TracerProvider} 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.
          # @param [optional Numeric] timeout An optional timeout in seconds.
          # @return [Integer] the result of the export.
          def export(spans, timeout: nil)
            return SUCCESS unless @stopped

            FAILURE
          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

8 entries across 8 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.15.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.14.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.13.1 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.13.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.12.1 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.12.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.11.1 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb
opentelemetry-sdk-0.11.0 lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb