lib/aspecto/opentelemetry/sampler/message_process_sampler.rb in aspecto-opentelemetry-0.1.10 vs lib/aspecto/opentelemetry/sampler/message_process_sampler.rb in aspecto-opentelemetry-0.2.0.rc0

- old
+ new

@@ -27,19 +27,19 @@ end private def should_sample_processing(parent_context, links, name, attributes) - return if !links || links.length.zero? + return if !links || links.empty? decision = link_decision(links[0]) # sidekiq receive side is a single "process" span which is the entry for the trace is_root = ::OpenTelemetry::Trace.current_span(parent_context) == ::OpenTelemetry::Trace::Span::INVALID if is_root # rubocop:disable Style/GuardClause matched_rule = @rules_sampler.matching_rule(name: name, attributes: attributes) rule_context = matched_rule&.context - return ::OpenTelemetry::SDK::Trace::Samplers::Result.new(decision: decision, tracestate: ::OpenTelemetry::Trace.current_span(parent_context).context.tracestate) if rule_context && rule_context["messaging.sampling.inherit_from_publisher"] + ::OpenTelemetry::SDK::Trace::Samplers::Result.new(decision: decision, tracestate: ::OpenTelemetry::Trace.current_span(parent_context).context.tracestate) if rule_context && rule_context["messaging.sampling.inherit_from_publisher"] end # if not root, then we need to check if the entry span set "messaging.sampling.inherit_from_publisher" on the context. # since we currently only support sidekiq, it is not needed. # but in the future, it can be implemented with context.attach when the rule is applied, and context.get here