Class: Jaeger::Samplers::Const

Inherits:
Object
  • Object
show all
Defined in:
lib/jaeger/samplers/const.rb

Overview

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.

Instance Method Summary collapse

Constructor Details

#initialize(decision) ⇒ Const

Returns a new instance of Const.



11
12
13
14
15
16
17
# File 'lib/jaeger/samplers/const.rb', line 11

def initialize(decision)
  @decision = decision
  @tags = {
    'sampler.type' => 'const',
    'sampler.param' => @decision ? 1 : 0
  }
end

Instance Method Details

#sampleObject



19
20
21
# File 'lib/jaeger/samplers/const.rb', line 19

def sample(*)
  [@decision, @tags]
end