The Ruby agent has built-in instrumentation for the
Delayed::Job library. No additional instrumentation is required.
Access to this feature depends on your subscription level.
Viewing background tasks
As long as the New Relic Ruby agent's gem or plugin is loaded before the
Delayed::Job worker starts, all tasks will be monitored with the same level of detail as controller actions. To view the actions themselves:
- Go to rpm.newrelic.com > APM > Applications > (select an app) > Monitoring > Transactions.
- From the APM Transactions page, select Other transactions.
The Ruby agent depends on being able to identify that it is running under
Delayed::Job in order to correctly set up instrumentation. To do this, it examines the script name (the
$0 variable in Ruby) to see whether it ends with
If you have renamed the script you use to start your
delayed_job workers to something else, or if you have a custom script with a different name, you will need to explicitly tell the agent that you are using
Delayed::Job by setting the
NEW_RELIC_DISPATCHER environment variable to
delayed_job when starting your
Delayed::Job workers. For example:
NEW_RELIC_DISPATCHER=delayed_job bundle exec ./script/my_custom_script
If it appears that jobs are not being monitored, review the newrelic_agent.log file generated when the worker starts up. It should indicate whether the agent detects
Delayed and communicates with the server. If you do not find a log, or if you still cannot determine why the jobs do not appear, get support at support.newrelic.com.