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.
175 176 177 |
# File 'lib/datadog/tracing/component.rb', line 175 def initialize(sampler) @sampler = sampler end |
Instance Attribute Details
#sampler ⇒ Object
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 |