Class: Labkit::Tracing::JaegerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/labkit/tracing/jaeger_factory.rb

Constant Summary collapse

DEFAULT_PROBABILISTIC_RATE =

When the probabilistic sampler is used, by default 0.1% of requests will be traced

0.001
DEFAULT_UDP_PORT =

The default port for the Jaeger agent UDP listener

6831
FLUSH_INTERVAL =

Reduce this from default of 10 seconds as the Ruby jaeger client doesn’t have overflow control, leading to very large messages which fail to send over UDP (max packet = 64k) Flush more often, with smaller packets

5

Class Method Summary collapse

Class Method Details

.create_tracer(service_name, options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/labkit/tracing/jaeger_factory.rb', line 20

def self.create_tracer(service_name, options)
  kwargs = {
    service_name: service_name,
    sampler: get_sampler(options[:sampler], options[:sampler_param]),
    reporter: get_reporter(service_name, options[:http_endpoint], options[:udp_endpoint])
  }
    .compact

  extra_params = options.except(:sampler, :sampler_param, :http_endpoint, :udp_endpoint, :strict_parsing, :debug)
  if extra_params.present?
    message = "jaeger tracer: invalid option: #{extra_params.keys.join(', ')}"

    raise message if options[:strict_parsing]

    warn message
  end

  Jaeger::Client.build(kwargs)
end