debian-mirror-gitlab/debian/gems-compat/jaeger-client-0.10.0/lib/jaeger/samplers/const.rb
2019-03-14 13:21:19 +05:30

24 lines
557 B
Ruby

# frozen_string_literal: true
module Jaeger
module Samplers
# Const sampler
#
# A sampler that always makes the same decision for new traces depending
# on the initialization value. Use `Jaeger::Samplers::Const.new(true)`
# to mark all new traces as sampled.
class Const
def initialize(decision)
@decision = decision
@tags = {
'sampler.type' => 'const',
'sampler.param' => @decision ? 1 : 0
}
end
def sample?(*)
[@decision, @tags]
end
end
end
end