Class: OpenTelemetry::SDK::Trace::Samplers::ParentOrElse Private
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Trace::Samplers::ParentOrElse
- Defined in:
- lib/opentelemetry/sdk/trace/samplers/parent_or_else.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This is a composite sampler. It either respects the parent span's sampling decision or delegates to delegate_sampler for root spans.
Instance Method Summary collapse
- #description ⇒ Object private
-
#initialize(delegate_sampler) ⇒ ParentOrElse
constructor
private
A new instance of ParentOrElse.
- #should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) ⇒ Boolean private
Constructor Details
#initialize(delegate_sampler) ⇒ ParentOrElse
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ParentOrElse.
16 17 18 |
# File 'lib/opentelemetry/sdk/trace/samplers/parent_or_else.rb', line 16 def initialize(delegate_sampler) @delegate_sampler = delegate_sampler end |
Instance Method Details
#description ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/opentelemetry/sdk/trace/samplers/parent_or_else.rb', line 23 def description "ParentOrElse{#{@delegate_sampler.description}}" end |
#should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 |
# File 'lib/opentelemetry/sdk/trace/samplers/parent_or_else.rb', line 30 def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) if parent_context.nil? @delegate_sampler.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes) elsif parent_context.trace_flags.sampled? RECORD_AND_SAMPLED else NOT_RECORD end end |