lib/sentry/opentelemetry/propagator.rb in sentry-opentelemetry-5.16.1 vs lib/sentry/opentelemetry/propagator.rb in sentry-opentelemetry-5.17.0

- old
+ new

@@ -1,11 +1,10 @@ # frozen_string_literal: true module Sentry module OpenTelemetry class Propagator - FIELDS = [SENTRY_TRACE_HEADER_NAME, BAGGAGE_HEADER_NAME].freeze SENTRY_TRACE_KEY = ::OpenTelemetry::Context.create_key('sentry-trace') SENTRY_BAGGAGE_KEY = ::OpenTelemetry::Context.create_key('sentry-baggage') @@ -49,17 +48,18 @@ remote: true ) baggage_header = getter.get(carrier, BAGGAGE_HEADER_NAME) - baggage = if baggage_header && !baggage_header.empty? - Baggage.from_incoming_header(baggage_header) - else - # If there's an incoming sentry-trace but no incoming baggage header, - # for instance in traces coming from older SDKs, - # baggage will be empty and frozen and won't be populated as head SDK. - Baggage.new({}) - end + baggage = + if baggage_header && !baggage_header.empty? + Baggage.from_incoming_header(baggage_header) + else + # If there's an incoming sentry-trace but no incoming baggage header, + # for instance in traces coming from older SDKs, + # baggage will be empty and frozen and won't be populated as head SDK. + Baggage.new({}) + end baggage.freeze! context = context.set_value(SENTRY_BAGGAGE_KEY, baggage) span = ::OpenTelemetry::Trace.non_recording_span(span_context)