Sha256: 03077a56246df59c521ab959538e4897df39fe06d0f771ee2694213baf680176

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Exporter
    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

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-exporter-jaeger-0.10.0 lib/opentelemetry/exporter/jaeger/transport.rb
opentelemetry-exporter-jaeger-0.9.0 lib/opentelemetry/exporter/jaeger/transport.rb
opentelemetry-exporter-jaeger-0.8.0 lib/opentelemetry/exporter/jaeger/transport.rb
opentelemetry-exporter-jaeger-0.7.0 lib/opentelemetry/exporter/jaeger/transport.rb
opentelemetry-exporter-jaeger-0.6.0 lib/opentelemetry/exporter/jaeger/transport.rb