Sha256: ce78054104fd22ca4047da334582aca0f3d1aebd34f050a31db7cb1996f46749

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Exporters
    module Jaeger
      # A Thrift-compatible UDP transport.
      class Transport
        def initialize(host, port)
          @socket = UDPSocket.new
          @socket.connect(host, port)
          @buffer = ::Thrift::MemoryBufferTransport.new
        end

        def write(string)
          @buffer.write(string)
        end

        def flush
          @socket.send(@buffer.read(@buffer.available), 0)
          @socket.flush
        rescue Errno::ECONNREFUSED
          OpenTelemetry.logger.warn('Unable to connect to Jaeger Agent')
        rescue StandardError => e
          OpenTelemetry.logger.warn("Unable to send spans: #{e.message}")
        end

        def open; end

        def close; end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opentelemetry-exporters-jaeger-0.5.0 lib/opentelemetry/exporters/jaeger/transport.rb
opentelemetry-exporters-jaeger-0.4.0 lib/opentelemetry/exporters/jaeger/transport.rb
opentelemetry-exporters-jaeger-0.3.0 lib/opentelemetry/exporters/jaeger/transport.rb
opentelemetry-exporters-jaeger-0.2.0 lib/opentelemetry/exporters/jaeger/transport.rb