lib/sentry/rails/action_cable.rb in sentry-rails-5.4.2 vs lib/sentry/rails/action_cable.rb in sentry-rails-5.5.0

- old
+ new

@@ -11,12 +11,12 @@ env = connection.respond_to?(:env) ? connection.env : {} Sentry.with_scope do |scope| scope.set_rack_env(env) scope.set_context("action_cable", extra_context) if extra_context - scope.set_transaction_name(transaction_name) - transaction = start_transaction(env, scope.transaction_name) + scope.set_transaction_name(transaction_name, source: :view) + transaction = start_transaction(env, scope) scope.set_span(transaction) if transaction begin block.call finish_transaction(transaction, 200) @@ -27,13 +27,15 @@ raise end end end - def start_transaction(env, transaction_name) + def start_transaction(env, scope) sentry_trace = env["HTTP_SENTRY_TRACE"] - options = { name: transaction_name, op: "rails.action_cable".freeze } - transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, **options) if sentry_trace + baggage = env["HTTP_BAGGAGE"] + + options = { name: scope.transaction_name, source: scope.transaction_source, op: "rails.action_cable".freeze } + transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, baggage: baggage, **options) if sentry_trace Sentry.start_transaction(transaction: transaction, **options) end def finish_transaction(transaction, status_code) return unless transaction