New Relic recommends installing the Ruby gem in order to have better control over versions and dependencies. However, the gem is not supported for Rails versions prior to 2.0. If you are using Rails 1.2.6 and earlier, install the plugin.
Our gem is available on rubygems.org as
sudo gem install newrelic_rpm
For Rails 3 and installations using Bundler, simply add our gem to the Gemfile:
For Rails versions 2.1 to 2.3 without Bundler, edit environment.rb and add to the initializer block:
For Rails versions 2.0.*, edit environment.rb and add this statement after the initializer block:
After installing the agent, copy the
newrelic.yml file into the
config subdirectory of your application. You can download a fresh
newrelic.yml that includes your license key from the Account Settings link when logged in to rpm.newrelic.com.
Note: As part of the installation process, change the default application name to a meaningful name.
Whenever you update the agent, double-check that your Agent configuration file (
config/newrelic.yml) is up to date. To do this, you'll need to do a visual inspection of the default newrelic.yml file that lives in the Agent plugin folder (
vendor/plugins/newrelic_rpm/newrelic.yml). Look for new configuration options that aren't in your
sudo gem update newrelic_rpm
Typically you will install New Relic in your production environment to get the most out of our performance reporting features for your applications. If you want to try out the Ruby agent in a development or localhost environment, be aware that by default, New Relic will not report any metrics.
To deploy New Relic outside your production environment and still be able to view your app's performance metrics: In your newrelic.yml file's
development: block, change the
monitor_mode config value to
For more information about using New Relic's Ruby agent outside production environments, see Developer mode.
In versions 2.13 and above, the New Relic Ruby agent will properly handle Bundler initialization under Rails 3 and Rails 2.3.
Add the gem specification to your Gemfile. Recommendation: Place the New Relic gem as low in the list as possible, allowing the frameworks above it to be instrumented when the gem initializes:
If you installed the plugin as a gem, remove all references to
newrelic_rpm from your
Additional documentation resources include:
If you need additional help, get support at support.newrelic.com.