Sha256: a9ce5e2b01a0b6acefdbd0055afc80621d1f0e915b0326be46bb466e798f9b49

Contents?: true

Size: 1.55 KB

Versions: 13

Compression:

Stored size: 1.55 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)
        request.env['appoptics_apm.controller'] = self.class.name
        request.env['appoptics_apm.action'] = self.action_name

        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
          kvs.delete(:Backtrace)
          AppOpticsAPM::API.log(nil, 'info', kvs)
          raise
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
appoptics_apm-4.9.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.8.4 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.8.3 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.8.2 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.8.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.8.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.7.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.6.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm_mnfst-4.5.2 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.5.2 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.5.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.5.0 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
appoptics_apm-4.4.1 lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb