lib/opentelemetry/sdk/trace/samplers/parent_based.rb in opentelemetry-sdk-0.8.0 vs lib/opentelemetry/sdk/trace/samplers/parent_based.rb in opentelemetry-sdk-0.9.0

- old
+ new

@@ -35,15 +35,16 @@ # @api private # # See {Samplers}. def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) - delegate = if parent_context.nil? + parent_span_context = OpenTelemetry::Trace.current_span(parent_context).context + delegate = if !parent_span_context.valid? @root - elsif parent_context.remote? - parent_context.trace_flags.sampled? ? @remote_parent_sampled : @remote_parent_not_sampled + elsif parent_span_context.remote? + parent_span_context.trace_flags.sampled? ? @remote_parent_sampled : @remote_parent_not_sampled else - parent_context.trace_flags.sampled? ? @local_parent_sampled : @local_parent_not_sampled + parent_span_context.trace_flags.sampled? ? @local_parent_sampled : @local_parent_not_sampled end delegate.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes) end end end