Sha256: ddec1f8f17e367c7499745d248c5390a9749b0da0ffd60159c64d77ceb134af0

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require_relative './udp_sender/transport'
require 'socket'

module Jaeger
  class UdpSender
    def initialize(host:, port:, encoder:, logger:)
      @encoder = encoder
      @logger = logger

      transport = Transport.new(host, port)
      protocol = ::Thrift::CompactProtocol.new(transport)
      @client = Jaeger::Thrift::Agent::Client.new(protocol)
    end

    def send_spans(spans)
      batch = @encoder.encode(spans)
      @client.emitBatch(batch)
    rescue StandardError => error
      @logger.error("Failure while sending a batch of spans: #{error}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jaeger-client-0.10.0 lib/jaeger/udp_sender.rb