Sha256: 2a285bdec5ff7e86a2ff3df956400ef20926a1524ba44f6b0a46d891fe739199

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

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

        transaction = Appsignal::Transaction.create(
          env[Appsignal::Hooks::ActionCableHook::REQUEST_ID],
          Appsignal::Transaction::ACTION_CABLE,
          request
        )

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appsignal-3.10.0-java lib/appsignal/integrations/action_cable.rb
appsignal-3.10.0 lib/appsignal/integrations/action_cable.rb
appsignal-3.9.3-java lib/appsignal/integrations/action_cable.rb
appsignal-3.9.3 lib/appsignal/integrations/action_cable.rb
appsignal-3.9.2-java lib/appsignal/integrations/action_cable.rb
appsignal-3.9.2 lib/appsignal/integrations/action_cable.rb