Module: Jaeger::Client

Defined in:
lib/jaeger/client.rb,
lib/jaeger/client/version.rb

Constant Summary collapse

UdpSender =

We initially had everything under Jaeger::Client namespace. This however was not very useful and was removed. These assignments are here for backwards compatibility. Fine to remove in the next major version.

Jaeger::UdpSender
HttpSender =
Jaeger::HttpSender
Encoders =
Jaeger::Encoders
Samplers =
Jaeger::Samplers
Reporters =
Jaeger::Reporters
Injectors =
Jaeger::Injectors
Extractors =
Jaeger::Extractors
DEFAULT_FLUSH_INTERVAL =
10
VERSION =
'1.3.0'

Class Method Summary collapse

Class Method Details

.build(service_name:, host: '127.0.0.1', port: 6831, flush_interval: DEFAULT_FLUSH_INTERVAL, sampler: Samplers::Const.new(true), logger: Logger.new($stdout), sender: nil, reporter: nil, injectors: {}, extractors: {}, tags: {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/jaeger/client.rb', line 46

def self.build(service_name:,
               host: '127.0.0.1',
               port: 6831,
               flush_interval: DEFAULT_FLUSH_INTERVAL,
               sampler: Samplers::Const.new(true),
               logger: Logger.new($stdout),
               sender: nil,
               reporter: nil,
               injectors: {},
               extractors: {},
               tags: {})
  encoder = Encoders::ThriftEncoder.new(service_name: service_name, tags: tags, logger: logger)

  if sender
    warn '[DEPRECATION] Passing `sender` directly to Jaeger::Client.build is deprecated.' \
         'Please use `reporter` instead.'
  end

  reporter ||= Reporters::RemoteReporter.new(
    sender: sender || UdpSender.new(host: host, port: port, encoder: encoder, logger: logger),
    flush_interval: flush_interval
  )

  Tracer.new(
    reporter: reporter,
    sampler: sampler,
    injectors: Injectors.prepare(injectors),
    extractors: Extractors.prepare(extractors)
  )
end