Sha256: cb02fe8eeca94f3144566e7ea8bfdcfe72f8d85feac6945eb7d662187677a65b

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

# Control subclass instantiated when Rails is detected.  Contains
# Rails specific configuration, instrumentation, environment values,
# etc.
require 'new_relic/control/frameworks/rails'
module NewRelic
  class Control
    module Frameworks
      class Rails3 < NewRelic::Control::Frameworks::Rails

        def env
          ::Rails.env.to_s
        end

        def root
          ::Rails.root.to_s
        end

        def logger
          ::Rails.logger
        end


        def log!(msg, level=:info)
          return unless should_log?
          logger.send(level, msg)
        rescue Exception => e
          super
        end

        def to_stdout(msg)
          logger.info(msg)
        rescue
          super
        end

        def vendor_root
          @vendor_root ||= File.join(root,'vendor','rails')
        end

        def version
          @rails_version ||= NewRelic::VersionNumber.new(::Rails::VERSION::STRING)
        end

        protected

        # Collect the Rails::Info into an associative array as well as the list of plugins
        def append_environment_info
          local_env.append_environment_value('Rails version'){ version }
          local_env.append_environment_value('Rails threadsafe') do
            true == ::Rails.configuration.action_controller.allow_concurrency
          end
          local_env.append_environment_value('Rails Env') { env }
          local_env.append_gem_list do
            bundler_gem_list
          end
          local_env.append_plugin_list { ::Rails.configuration.plugins.to_a }
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.1.0.beta2 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-3.0.1 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-3.1.0.beta1 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-3.0.0 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-3.0.0.beta2 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-3.0.0.beta1 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-2.14.1.logging1 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-2.14.1 lib/new_relic/control/frameworks/rails3.rb
newrelic_rpm-2.14.0 lib/new_relic/control/frameworks/rails3.rb