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.



187
188
189
# File 'lib/datadog/tracing/component.rb', line 187

def initialize(sampler)
  @sampler = sampler
end

Instance Attribute Details

#samplerObject

Returns the value of attribute sampler.



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

def sampler
  @sampler
end

Instance Method Details

#sample!(trace) ⇒ Object



191
192
193
# File 'lib/datadog/tracing/component.rb', line 191

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

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



195
196
197
198
199
# File 'lib/datadog/tracing/component.rb', line 195

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

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