Sha256: f645551c20ad5332fc009db2f8e8437390f08a21225227e1c97c4c9df0fa4af9

Contents?: true

Size: 1.63 KB

Versions: 23

Compression:

Stored size: 1.63 KB

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

module AppOpticsAPM
  module Inst
    #
    # ActionController
    #
    # This modules contains the instrumentation code specific
    # to Rails v3
    #
    module ActionController
      include ::AppOpticsAPM::Inst::RailsBase

      def self.included(base)
        base.class_eval do
          alias_method_chain :process, :appoptics
          alias_method_chain :process_action, :appoptics
          alias_method_chain :render, :appoptics
        end
      end

      def process_with_appoptics(*args)
        kvs = {
            :Controller   => self.class.name,
            :Action       => self.action_name,
        }
        request.env['appoptics_apm.controller'] = kvs[:Controller]
        request.env['appoptics_apm.action'] = kvs[:Action]

        trace('rails') do
          process_without_appoptics(*args)
        end
      end

      def process_action_with_appoptics(*args)
        kvs = {
            :Controller   => self.class.name,
            :Action       => action_name,
        }
        request.env['appoptics_apm.controller'] = kvs[:Controller]
        request.env['appoptics_apm.action'] = kvs[:Action]

        return process_action_without_appoptics(*args) unless AppOpticsAPM.tracing?
        begin
          kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:action_controller][:collect_backtraces]
          AppOpticsAPM::API.log(nil, 'info', kvs)

          process_action_without_appoptics(*args)
        rescue Exception
          kvs[:Status] = 500
          AppOpticsAPM::API.log(nil, 'info', kvs)
          raise
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
appoptics_apm-4.4.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.3.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.3.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.7 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.6 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.5 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.4 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.3 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.2 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.2.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.1.2 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.9 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.1.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.8 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.1.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.7 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.6 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.5 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.0.4 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb