Class: Jaeger::Client::Samplers::Const

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

Overview

Const sampler

A sampler that always makes the same decision for new traces depending on the initialization value. Use ‘Jaeger::Client::Samplers::Const.new(true)` to mark all new traces as sampled.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(decision) ⇒ Const

Returns a new instance of Const.



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

def initialize(decision)
  @decision = decision
  @param = decision ? '1' : '0'
end

Instance Attribute Details

#paramObject (readonly)

Returns the value of attribute param.



25
26
27
# File 'lib/jaeger/client/samplers/const.rb', line 25

def param
  @param
end

Instance Method Details

#sample?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/jaeger/client/samplers/const.rb', line 17

def sample?(*)
  @decision
end

#typeObject



21
22
23
# File 'lib/jaeger/client/samplers/const.rb', line 21

def type
  'const'
end