Class: Aspecto::OpenTelemetry::Sampler::MessageProcessSampler
- Inherits:
-
Object
- Object
- Aspecto::OpenTelemetry::Sampler::MessageProcessSampler
- Defined in:
- lib/aspecto/opentelemetry/sampler/message_process_sampler.rb
Overview
OpenTelemetry sampler which implements the remote rules logic with fallback to service sampler
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(rules_sampler, service_sampler) ⇒ MessageProcessSampler
constructor
A new instance of MessageProcessSampler.
- #should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) ⇒ Boolean
Constructor Details
#initialize(rules_sampler, service_sampler) ⇒ MessageProcessSampler
Returns a new instance of MessageProcessSampler.
12 13 14 15 |
# File 'lib/aspecto/opentelemetry/sampler/message_process_sampler.rb', line 12 def initialize(rules_sampler, service_sampler) @rules_sampler = rules_sampler @service_sampler = service_sampler end |
Instance Method Details
#description ⇒ Object
25 26 27 |
# File 'lib/aspecto/opentelemetry/sampler/message_process_sampler.rb', line 25 def description "MessageProcessSampler" end |
#should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'lib/aspecto/opentelemetry/sampler/message_process_sampler.rb', line 17 def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) if attributes && attributes[::OpenTelemetry::SemanticConventions::Trace::MESSAGING_OPERATION] == "process" sampling_decision = should_sample_processing(parent_context, links, name, attributes) return sampling_decision if sampling_decision end @service_sampler.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes) end |