I was able to configure new relic to monitor my rake task thanks to newrelic-rake gem. Now, my rake tasks are under Transactions tab, in the rake option from transaction type select box. Those rake tasks are working every few minutes, thanks to cron job. And my questions is:
How can I assign alert from new relic, if rake task will throw an error?
I mean, I know I can create alerts if the whole app throws certain amount of errors, or memory consumption is too high, but how assign it to specific rake task? Do I need to upgrade my account to pro subscription level and use key transaction alert? I was trying to use new beta alerts system but it seems that I cannot assign rake task anywhere.
Thanks for help.
Upgrading to pro and defining a Key Transaction in your rake task should do it. Without upgrading, there are a couple other things to try.
If you have access to custom metrics alerting, you might be able to count your rake errors there.
You can also report your rake tasks do a different NewRelic application and set up alerts on that one. NewRelic will look for a NEW_RELIC_APP_NAME
environment variable at startup, which you can set to my-rake-tasks
. If you want them to continue reporting to the main application too, you can separate multiple names with semicolons:
NEW_RELIC_APP_NAME='my-app;my-rake-tasks' rake foo
You might also consider some of the dedicated error reporting services, like HoneyBadger or Airbrake, which may have more focused tools.