Using New Relic to monitor a Padrino Application
Getting New Relic hooked into your Padrino application isn’t too hard – there are a just a few gotchas.
(Before starting, make sure you have a valid config/new_relic.yml configuration file in place.)
If you’ve tried this already, you may have run into this error:
TypeError - can't convert String into Integer: .../newrelic_rpm-3.1.0/lib/new_relic/agent/instrumentation/sinatra.rb:36:in `'
The padrino-rpm gem fixes the bug that causes this error. Which brings us to step 1 – install or bundle padrino-rpm from github.
gem 'padrino' # Padrino needs to be loaded first! gem 'padrino-rpm', :git => 'https://github.com/Asquera/padrino-rpm.git'
Require the gems in order within your app or apps.rb:
require 'padrino' require 'padrino-rpm' require 'newrelic_rpm'
The padrino_rpm gem relies on before_load and after_load hooks to add its instrumentation. So, make sure your Padrino application initializes using
or else the instrumentation won’t take effect.
Once these changes are in place, restart your server and tail log/newrelic_agent.log. You should now see New Relic reporting and your pages working.
Here a link to New Relic support that may contain more information:
With the head tag:
And just before the end of your body tag:
After a few minutes head over to New Relic and you should find some neat browser metrics about DOM Performance and Page Rendering.