class Jaeger::Client::Samplers::Probabilistic

Probabilistic sampler

Sample a portion of traces using trace_id as the random decision

Attributes

param[R]

Public Class Methods

new(rate: 0.001) click to toggle source
# File lib/jaeger/client/samplers/probabilistic.rb, line 10
def initialize(rate: 0.001)
  @param = rate.to_s
  if rate < 0.0 || rate > 1.0
    raise "Sampling rate must be between 0.0 and 1.0, got #{rate.inspect}"
  end
  @boundary = TraceId::TRACE_ID_UPPER_BOUND * rate
end

Public Instance Methods

sample?(trace_id) click to toggle source
# File lib/jaeger/client/samplers/probabilistic.rb, line 18
def sample?(trace_id)
  @boundary >= trace_id
end
type() click to toggle source
# File lib/jaeger/client/samplers/probabilistic.rb, line 22
def type
  'probabilistic'
end