artsy-newrelic

Plug-and-play NewRelic module wrapper configured for Artsy Node apps. Features include:

Usage no npm install needed!

<script type="module">
  import artsyNewrelic from 'https://cdn.skypack.dev/artsy-newrelic';
</script>

README

artsy-newrelic

Plug-and-play NewRelic module wrapper configured for Artsy Node apps. Features include:

  • Middleware to inject browser monitoring
  • Report uncaught exceptions
  • No-op when the NEW_RELIC_LICENSE_KEY environment variable is omitted
  • Timeout after 30 seconds and report the timeout

Example

Require above your app instance, and mount the middleware.

var newrelic = require('artsy-newrelic');
var app = express();
app.use(newrelic);

Add browser-side detection

head
  != newRelicHead

Use env vars to configure (values are defaults)

NEW_RELIC_LICENSE_KEY=
NEW_RELIC_APP_NAME=process.env.APP_NAME
NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES=400,401,402,[...],499

Leave NEW_RELIC_LICENSE_KEY out in dev/test environments and NewRelic won't bother you.

Testing

Create a .env file in the root of this project with NEW_RELIC_LICENSE_KEY and APP_NAME set. Run npm run example and check your NewRelic panel to see it integrate.

License

MIT