Class: OpenTelemetry::Exporter::Jaeger::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/exporter/jaeger/transport.rb

Overview

A Thrift-compatible UDP transport.

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Transport

Returns a new instance of Transport.



12
13
14
15
16
# File 'lib/opentelemetry/exporter/jaeger/transport.rb', line 12

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

Instance Method Details

#closeObject



33
# File 'lib/opentelemetry/exporter/jaeger/transport.rb', line 33

def close; end

#flushObject



22
23
24
25
26
27
28
29
# File 'lib/opentelemetry/exporter/jaeger/transport.rb', line 22

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

#openObject



31
# File 'lib/opentelemetry/exporter/jaeger/transport.rb', line 31

def open; end

#write(string) ⇒ Object



18
19
20
# File 'lib/opentelemetry/exporter/jaeger/transport.rb', line 18

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