Module: RPMContrib::Instrumentation::Camping
- Defined in:
- lib/rpm_contrib/instrumentation/camping.rb
Overview
Instrumentation for Camping
To instrument all controllers do the following:
-
Add require ‘rpm_contrib’ after loading camping.
-
Add an include at the end of your main Camping app module
-
Run the following command to get the NewRelic license key to use: heroku config -all
-
Create a newrelic.yml under the /config folder with the following content:
common: &default_settings
license_key: 'PASTE THE VALUE OF NEW_RELIC_LICENSE_KEY HERE'
app_name: PASTE THE NAME OF YOUR CAMPING APP HERE
monitor_mode: true
production:
<<: *default_settings
Camping code example:
require “newrelic_rpm”
Camping.goes :NewRelicCampingTest
module NewRelicCampingTest
# your code
include NewRelic::Agent::Instrumentation::Camping
end
Class Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rpm_contrib/instrumentation/camping.rb', line 38 def self.included(mod) # Since the Camping::Base module is essentially copied # into the main module (the mod passed in) of a Camping app # using the Camping.goes :NewRelicCampingTest syntax # we need to evaluate "weld" the NewRelic plugin in the context of the new Base (Kernel.const_get(mod.name)::Base).module_eval do include NewRelic::Agent::Instrumentation::ControllerInstrumentation add_transaction_tracer :service end end |