flyerhzm/newrelic-grape — pull request #2 by dblock (2012-12-28 00:18:31+00:00)
Title: Set `DISABLE_NEW_RELIC_GRAPE` at runtime to disable instrumentation.

We have many environments in which the newrelic configuration is entirely driven by environment (this is how you do things on Heroku). So we want to be able to disable instrumentation via ENV as well.

* Added `ENV['DISABLE_NEW_RELIC_GRAPE']` which acts the same way as `disable_grape` in newrelic.yml.
* Change the implementation to check both at load time as it runtime. The runtime one lets you make the change without restarting the service through newrelic.yml (if your runtime supports it). This also enables tests since we don't reload everything between tests.

I would actually possibly be for removing the `disabled?` check from loading. Otherwise you cannot re-enable the instrumentation cause it wasn't loaded. Since I'm 50/50 you can sway one or the other direction :)