Skip to content

Instantly share code, notes, and snippets.

@pmuellr
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmuellr/d598afa2a40a16d41949 to your computer and use it in GitHub Desktop.
Save pmuellr/d598afa2a40a16d41949 to your computer and use it in GitHub Desktop.
new-relic-on-cloudfoundry newrelic.js
/**
* New Relic agent configuration.
*
* See lib/config.defaults.js in the agent distribution for a more complete
* description of configuration variables and their potential values.
*/
var pkg = require("./package.json")
var APP_NAME = pkg.name || "unnamed-app"
var ENV_VAR_NAME = "NEW_RELIC_LICENSE_KEY"
var NewRelicLicenseKey = process.env[ENV_VAR_NAME]
//------------------------------------------------------------------------------
exports.config = {
/**
* Array of application names.
*/
app_name : [APP_NAME],
/**
* Your New Relic license key.
*/
license_key : NewRelicLicenseKey || "no-license-key-provided",
logging : {
/**
* Level at which to log. 'trace' is most useful to New Relic when diagnosing
* issues with the agent, 'info' and higher will impose the least overhead on
* production applications.
*/
level : "info"
}
}
//------------------------------------------------------------------------------
exports.initialize = function() {
if (!NewRelicLicenseKey) {
console.log("newrelic not in use; env var " + ENV_VAR_NAME + " not set")
return
}
console.log("newrelic in use; app name: " + APP_NAME)
require("newrelic")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment