Sha256: 269ebd159d48f17fd369e3825780ccadd0bea12f13e39b6f9c43839c22f50a20

Contents?: true

Size: 1.2 KB

Versions: 20

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Integrations
    # @api private
    module ActionCableIntegration
      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.add_session_data { request.session.to_h if request.respond_to? :session }
          transaction.set_metadata("path", request.path)
          transaction.set_metadata("method", "websocket")
          transaction.add_tags(:request_id => request_id) if request_id
          Appsignal::Transaction.complete_current!
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
appsignal-4.3.3-java lib/appsignal/integrations/action_cable.rb
appsignal-4.3.3 lib/appsignal/integrations/action_cable.rb
appsignal-4.3.2-java lib/appsignal/integrations/action_cable.rb
appsignal-4.3.2 lib/appsignal/integrations/action_cable.rb
appsignal-4.3.1-java lib/appsignal/integrations/action_cable.rb
appsignal-4.3.1 lib/appsignal/integrations/action_cable.rb
appsignal-4.3.0-java lib/appsignal/integrations/action_cable.rb
appsignal-4.3.0 lib/appsignal/integrations/action_cable.rb
appsignal-4.2.3-java lib/appsignal/integrations/action_cable.rb
appsignal-4.2.3 lib/appsignal/integrations/action_cable.rb
appsignal-4.2.2-java lib/appsignal/integrations/action_cable.rb
appsignal-4.2.2 lib/appsignal/integrations/action_cable.rb
appsignal-4.2.1-java lib/appsignal/integrations/action_cable.rb
appsignal-4.2.1 lib/appsignal/integrations/action_cable.rb
appsignal-4.2.0-java lib/appsignal/integrations/action_cable.rb
appsignal-4.2.0 lib/appsignal/integrations/action_cable.rb
appsignal-4.1.3-java lib/appsignal/integrations/action_cable.rb
appsignal-4.1.3 lib/appsignal/integrations/action_cable.rb
appsignal-4.1.2-java lib/appsignal/integrations/action_cable.rb
appsignal-4.1.2 lib/appsignal/integrations/action_cable.rb