class Sentry::Transaction

def self.from_sentry_trace(sentry_trace, baggage: nil, hub: Sentry.get_current_hub, **options)

Returns:
  • (Transaction, nil) -

Parameters:
  • options (Hash) -- the options you want to use to initialize a Transaction instance.
  • hub (Hub) -- the hub that'll be responsible for sending this transaction when it's finished.
  • baggage (String, nil) -- the incoming baggage header string.
  • sentry_trace (String) -- the trace string from the previous transaction.
def self.from_sentry_trace(sentry_trace, baggage: nil, hub: Sentry.get_current_hub, **options)
  return unless hub.configuration.tracing_enabled?
  return unless sentry_trace
  sentry_trace_data = extract_sentry_trace(sentry_trace)
  return unless sentry_trace_data
  trace_id, parent_span_id, parent_sampled = sentry_trace_data
  baggage = if baggage && !baggage.empty?
              Baggage.from_incoming_header(baggage)
            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!
  new(
    trace_id: trace_id,
    parent_span_id: parent_span_id,
    parent_sampled: parent_sampled,
    hub: hub,
    baggage: baggage,
    **options
  )
end