Sha256: 7d649de0e6513e921db782511a2e6a1993b1f9e067ce7d774b94f9dd0f903300

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

# encoding: utf-8
require 'ting_yun/agent'
require 'ting_yun/instrumentation/support/controller_instrumentation'
require 'ting_yun/instrumentation/support/parameter_filtering'

module TingYun
  module Instrumentation
    module Rails3
      module ActionController

        def tingyun_metric_path(action_name_override = nil)

          return  self.env["PATH_INFO"] unless TingYun::Agent.config[:'nbs.auto_action_naming']

          action = action_name_override || action_name
          if action_name_override || self.class.action_methods.include?(action)
            "Rails3/#{self.class.controller_path}%2F#{action}"
          else
            "Rails3/#{self.class.controller_path}%2F(other)"
          end
        end



        def process_action(*args)
          params = TingYun::Instrumentation::Support::ParameterFiltering.filter_rails_request_parameters(request.filtered_parameters)
          perform_action_with_tingyun_trace(:category => :controller,
                                            :name     => self.action_name,
                                            :path     => tingyun_metric_path,
                                            :params   => params,
                                            :class_name => self.class.name) do
            super
          end
        end
      end
    end
  end
end


TingYun::Support::LibraryDetection.defer do
  @name = :rails3_controller

  depends_on do
    defined?(::Rails) && ::Rails::VERSION::MAJOR.to_i == 3
  end

  depends_on do
    defined?(ActionController) && defined?(ActionController::Base)
  end

  executes do
    ::TingYun::Agent.logger.info 'Installing Rails 3 Controller instrumentation'
  end

  executes do
    class ActionController::Base
      include TingYun::Instrumentation::Support::ControllerInstrumentation
      include TingYun::Instrumentation::Rails3::ActionController
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tingyun_rpm-1.1.0 lib/ting_yun/instrumentation/rails3/action_controller.rb
tingyun_rpm-1.0.7 lib/ting_yun/instrumentation/rails3/action_controller.rb
tingyun_rpm-1.0.6 lib/ting_yun/instrumentation/rails3/action_controller.rb