Problem
The Ruby agent is not properly starting or is not reporting data to New Relic.
Solution
To solve this problem:
Check your Ruby agent version, and update if necessary.
When the newrelic_rpm
Ruby gem is required in your application environment, it will attempt to determine whether to start monitoring automatically and begin transmitting metrics to New Relic, or to remain disabled.
Production and staging: The agent typically is configured to monitor automatically in these environments.
Test and development: The agent typically remains disabled in these environments.
To control this logic, set the
monitor_mode
configuration key totrue
orfalse
in each environment section ofnewrelic.yml
.
To override the agent's auto-start logic, the easiest mechanism is to set a NEW_RELIC_AGENT_ENABLED=true
environment variable; for example:
NEW_RELIC_AGENT_ENABLED=true rake assets:precompile
If you are running Ruby agent version 3.6.1 or higher, there are a few reasons the agent will refuse to start:
The agent detects it is in an interactive session; for example, a
rails console
orirb
session.The agent detects it is in one of Rails' built-in rake tasks; for example,
assets:precompile
ordb:migrate
.You can use configuration variables in your Ruby agent
newrelic.yml
file to customize auto-start behavior for constants, script names, and rake tasks.Variable
Description
Constants
- Ruby constants that should prevent the agent from starting. Accepts a comma separated list.
- Defaults to
"Rails::Console"
. - Set to
""
to tell the agent to start whenRails::Console
is in the environment.
Rake tasks
- Rake tasks you do not want the agent to monitor; for example,
assets:precompile
. Accepts a comma-separated list. - We do not disable the Ruby agent in all rake tasks, because tasks like
resque:work
generally are monitored.
Executables
- A list of script names, such as
irb
, that will prevent the agent from starting automatically. Accepts a comma-separated list. - Set this to
"rake"
to prevent the agent from starting in rake tasks, or"rake,my_ruby_script.rb"
to prevent it from starting in rake and a custom script.