Class: Datadog::Tracing::Component::SamplerDelegatorComponent
- Inherits:
-
Object
- Object
- Datadog::Tracing::Component::SamplerDelegatorComponent
- 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
-
#sampler ⇒ Object
Returns the value of attribute sampler.
Instance Method Summary collapse
-
#initialize(sampler) ⇒ SamplerDelegatorComponent
constructor
A new instance of SamplerDelegatorComponent.
- #sample!(trace) ⇒ Object
- #update(*args, **kwargs) ⇒ Object
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
#sampler ⇒ Object
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 |