Class: Datadog::Tracing::Component::SamplerDelegatorComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/component.rb

Overview

Sampler wrapper component, to allow for hot-swapping the sampler instance used by the tracer. Swapping samplers happens during Dynamic Configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sampler) ⇒ SamplerDelegatorComponent

Returns a new instance of SamplerDelegatorComponent.



175
176
177
# File 'lib/datadog/tracing/component.rb', line 175

def initialize(sampler)
  @sampler = sampler
end

Instance Attribute Details

#samplerObject

Returns the value of attribute sampler.



173
174
175
# File 'lib/datadog/tracing/component.rb', line 173

def sampler
  @sampler
end

Instance Method Details

#sample!(trace) ⇒ Object



179
180
181
# File 'lib/datadog/tracing/component.rb', line 179

def sample!(trace)
  @sampler.sample!(trace)
end

#update(*args, **kwargs) ⇒ Object



183
184
185
186
187
# File 'lib/datadog/tracing/component.rb', line 183

def update(*args, **kwargs)
  return unless @sampler.respond_to?(:update)

  @sampler.update(*args, **kwargs)
end