The Ruby agent auto-instruments your code so you can start monitoring applications.
Tip
Running on Kubernetes? See Kubernetes APM auto-attach.
Prerequisites
Check these requirements before you start.
Requirement | Details |
|---|---|
New Relic account | You need a New Relic account and your . Have it ready before you begin. |
Ruby version | See Ruby agent requirements and supported frameworks for supported Ruby versions. |
Operating system | UNIX-like operating systems: Linux, Solaris, FreeBSD, and macOS. See Ruby agent requirements and supported frameworks for details. |
Install the gem
Add the Ruby agent gem to your Gemfile:
gem 'newrelic_rpm'Then run:
$bundle installImportant
If you are using the agent in a Docker container, install the agent within each container. See Install in GAE flexible environment for a Docker-based deployment example.
Framework-specific notes:
- Rails: Rails automatically calls
Bundler.require, sonewrelic_rpmis required during startup with no additional steps. - Roda or Sinatra: You must manually call
require 'newrelic_rpm'in your application. - Other Rack apps: To use automatic browser monitoring, manually include the Rack middlewares provided by the agent.
Configure the agent
Download newrelic.yml from the New Relic GitHub repository and copy it into the config directory of your application.
The only two settings you must change before going live:
Set
license_keyto your .Set
app_nameto a meaningful name for your application.Alternatively, generate the config file with the CLI:
bash$newrelic install --license_key="YOUR_LICENSE_KEY" "YOUR_APP_NAME"
Verify data is flowing
Restart your web server.
Send at least two requests to your application.
Wait 2–3 minutes, then open one.newrelic.com > APM and look for your app by name.
Tip
App not appearing? See No data appears (Ruby).
Related articles
- Ruby agent requirements and supported frameworks — Supported Ruby versions, operating systems, and frameworks.
- Ruby agent configuration — All available configuration settings.
- Update the Ruby agent — How to upgrade to a newer version.
- Ruby agent on Heroku — Installation steps specific to Heroku.