Sha256: 8cfb813adea6d8f923475afdafad882493afd82af33a497d1499730b056ed884

Contents?: true

Size: 859 Bytes

Versions: 9

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

module Jaeger
  module Client
    class UdpSender
      class Transport
        FLAGS = 0

        def initialize(host, port)
          @socket = UDPSocket.new
          @host = host
          @port = port
          @buffer = ::Thrift::MemoryBufferTransport.new
        end

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

        def flush
          data = @buffer.read(@buffer.available)
          send_bytes(data)
        end

        def open; end

        def close; end

        private

        def send_bytes(bytes)
          @socket.send(bytes, FLAGS, @host, @port)
          @socket.flush
        rescue Errno::ECONNREFUSED
          warn 'Unable to connect to Jaeger Agent'
        rescue StandardError => e
          warn "Unable to send spans: #{e.message}"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
jaeger-client-0.9.0 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.8.0 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.7.1 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.7.0 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.6.1 lib/jaeger/client/udp_sender/transport.rb
boost-jaeger-client-0.7.1 lib/jaeger/client/udp_sender/transport.rb
boost-jaeger-client-0.7.0 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.6.0 lib/jaeger/client/udp_sender/transport.rb
jaeger-client-0.5.0 lib/jaeger/client/udp_sender/transport.rb