Last active
August 29, 2015 14:01
-
-
Save pmuellr/d598afa2a40a16d41949 to your computer and use it in GitHub Desktop.
new-relic-on-cloudfoundry newrelic.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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