Set `DISABLE_NEW_RELIC_GRAPE` at runtime to disable instrumentation. #2

Merged
merged 6 commits into from Dec 28, 2012

Conversation

Projects
None yet
2 participants
Contributor

dblock commented Dec 28, 2012

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 :)

Owner

flyerhzm commented Dec 28, 2012

I'm curious when will you disable newrelic at runtime? It doesn't affect the application even when newrelic servers down.

Contributor

dblock commented Dec 28, 2012

I can't come up with a useful example when I want to be able to disable the configuration at runtime. So maybe it's not a useful feature.

Any ideas how to reload the entire dependency-driven NewRelic configuration in a test so we can actually test enabling/disabling?

Contributor

dblock commented Dec 28, 2012

I already spent a while trying to figure out how to test this, so I give up :) This change is still a good one I think - it lets you disable instrumentation with an ENV variable. No tests :(

flyerhzm added a commit that referenced this pull request Dec 28, 2012

Merge pull request #2 from dblock/disabled
Set `DISABLE_NEW_RELIC_GRAPE` at runtime to disable instrumentation.

@flyerhzm flyerhzm merged commit 4bf928a into xinminlabs:master Dec 28, 2012

@dblock dblock deleted the dblock:disabled branch Dec 7, 2015

phoffer pushed a commit to phoffer/newrelic-roda that referenced this pull request Mar 2, 2016

Fixes #1 and #2
* Updates Gemspec to reflect fork maintenance
* Moves Gemspec into the file `newrelic-roda.gemspec`
* Moves development dependencies into the Gemspec
* Updates Gemfile to use Gemspec dependencies definition
* Updates development dependencies to contemporary versions
* Pins runtime dependencies to contemporary versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment