Sha256: ea3947be41ca62180be512eef4762231e2f276f6fbe865cb3cc22f2720f081f8

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

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

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

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

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

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

          AppOpticsAPM::API.log_entry('rails', kvs)

          process_action_without_appoptics(method_name, *args)

        rescue Exception => e
          AppOpticsAPM::API.log_exception(nil, e) if log_rails_error?(e)
          raise
        ensure
          AppOpticsAPM::API.log_exit('rails')
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
appoptics_apm-4.2.3 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.2.2 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.2.1 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.2.0 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.1.2 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.9 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.1.1 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.8 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.1.0 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.7 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.6 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.5 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.4 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.3 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.2 lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
appoptics_apm-4.0.1-x86_64-linux lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb