Module: Appsignal::Integrations::ActionCableIntegration Private

Defined in:
lib/appsignal/integrations/action_cable.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#perform_action(*args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/appsignal/integrations/action_cable.rb', line 7

def perform_action(*args, &block)
  # The request is only the original websocket request
  env = connection.env
  request = ActionDispatch::Request.new(env)
  request_id = request.request_id || SecureRandom.uuid
  env[Appsignal::Hooks::ActionCableHook::REQUEST_ID] ||= request_id

  transaction = Appsignal::Transaction.create(Appsignal::Transaction::ACTION_CABLE)

  begin
    super
  rescue Exception => exception # rubocop:disable Lint/RescueException
    transaction.set_error(exception)
    raise exception
  ensure
    transaction.set_action_if_nil("#{self.class}##{args.first["action"]}")
    transaction.add_params_if_nil(args.first)
    transaction.("path", request.path)
    transaction.("method", "websocket")
    transaction.add_tags(:request_id => request_id) if request_id
    Appsignal::Transaction.complete_current!
  end
end