New Relic + Backgrounded + Resque = Awesome

Ryan Sonnek bio photo By Ryan Sonnek

If you’re writing a rails app, you’re already using new relic to monitor your app right? Wouldn’t it be great to get the same performance monitoring of your Backgrounded operations as well?

Fork it up, now you can!

I’ve published a fork of the rpm_contrib gem that will automatically instrument and monitor your Backgrounded operations with absolutely no code changes! That’s right, all you need to do is include the wireframe-rpm_contrib gem and your Backgrounded Resque tasks will automatically be tracked!

Sourcecode available on github (fork of rpm_contrib):

Gem available on gemcutter:

The default rpm_contrib gem adds instrumentation for Resque jobs, but is not aware of Backgrounded jobs so all of the jobs were recorded as Backgrounded::Handler::ResqueHandler#perform. My little patch fixes that so that Backgrounded Resque jobs have the correct classname/method context.