11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/sentry/rails/action_cable.rb', line 11
def capture(connection, transaction_name:, extra_context: nil, &block)
return block.call unless Sentry.initialized?
env = connection.respond_to?(:env) ? connection.env : {}
Sentry.with_scope do |scope|
scope.set_rack_env(env)
scope.set_context("action_cable", ) if
scope.set_transaction_name(transaction_name, source: :view)
transaction = start_transaction(env, scope)
scope.set_span(transaction) if transaction
begin
result = block.call
finish_transaction(transaction, 200)
result
rescue Exception => e
Sentry::Rails.capture_exception(e)
finish_transaction(transaction, 500)
raise
end
end
end
|