Sha256: 49122288ebec97c2f20c79b3dfc157639a4a1ff78f8e90bc40e0227cd8d26024

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

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

require 'pp'

module OpenTelemetry
  module SDK
    module Trace
      module Export
        # Outputs {SpanData} to the console.
        #
        # Potentially useful for exploratory purposes.
        class ConsoleSpanExporter
          ResultCodes = OpenTelemetry::SDK::Trace::Export

          private_constant(:ResultCodes)

          def initialize
            @stopped = false
          end

          def export(spans)
            return ResultCodes::FAILED_NOT_RETRYABLE if @stopped

            Array(spans).each { |s| pp s }

            ResultCodes::SUCCESS
          end

          def shutdown
            @stopped = true
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.4.0 lib/opentelemetry/sdk/trace/export/console_span_exporter.rb
opentelemetry-sdk-0.3.0 lib/opentelemetry/sdk/trace/export/console_span_exporter.rb
opentelemetry-sdk-0.2.0 lib/opentelemetry/sdk/trace/export/console_span_exporter.rb