Sha256: 17a962fe19719e767c3bc0984ff8f80746589397807dd81fc60d713d5bacecc2

Contents?: true

Size: 1.32 KB

Versions: 11

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 v5.
    #
    module ActionControllerAPI
      include ::AppOpticsAPM::Inst::RailsBase

      def process_action(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[:Controller]

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

          AppOpticsAPM::API.log_entry('rails-api', kvs)
          super(method_name, *args)

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

      #
      # render
      #
      # Our render wrapper that calls 'add_logging', which will log if we are tracing
      #
      def render(*args, &blk)
        trace('actionview') do
          super(*args, &blk)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
appoptics_apm-4.0.9 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.1.1 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.8 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.1.0 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.7 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.6 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.5 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.4 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.3 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.2 lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
appoptics_apm-4.0.1-x86_64-linux lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb