Sha256: a3c08db750304de347b27c639a02dd8fffb0610c10795833f177bcfbe2565f45

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

# Copyright (c) 2016 AppNeta, Inc.
# All rights reserved.

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

      def self.included(klass)
        ::TraceView::Util.method_alias(klass, :perform_action)
        ::TraceView::Util.method_alias(klass, :rescue_action)
        ::TraceView::Util.method_alias(klass, :process)
        ::TraceView::Util.method_alias(klass, :render)
      end

      def process_with_traceview(*args)
        TraceView::API.log_entry('rails')
        process_without_traceview(*args)

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

      def perform_action_with_traceview(*arguments)
        report_kvs = {
          :Controller  => @_request.path_parameters['controller'],
          :Action      => @_request.path_parameters['action']
        }
        TraceView::API.log(nil, 'info', report_kvs)
        perform_action_without_traceview(*arguments)
      end

      def rescue_action_with_traceview(exn)
        TraceView::API.log_exception(nil, exn) if log_rails_error?(exn)
        rescue_action_without_traceview(exn)
      end

      def render_with_traceview(options = nil, extra_options = {}, &block)
        TraceView::API.log_entry('actionview')
        render_without_traceview(options, extra_options, &block)

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
traceview-3.8.0-java lib/traceview/frameworks/rails/inst/action_controller2.rb
traceview-3.8.0 lib/traceview/frameworks/rails/inst/action_controller2.rb
traceview-3.7.1-java lib/traceview/frameworks/rails/inst/action_controller2.rb
traceview-3.7.1 lib/traceview/frameworks/rails/inst/action_controller2.rb
traceview-3.7.0-java lib/traceview/frameworks/rails/inst/action_controller2.rb
traceview-3.7.0 lib/traceview/frameworks/rails/inst/action_controller2.rb