good-sentry
Sentry broadcasting for good process monitor.
good-sentry
is a write stream used to send hapi server events to a Sentry server.
Usage
new GoodSentry ([options])
Creates a new GoodSentry object with the following arguments:
[options]
- optional configuration object with the following keys[dsn]
- Sentry project's Data Source Name. Defaults tonull
but expectsSENTRY_DSN
environment variable to be set.[config]
- optional configuration object with the following keys[name]
- The name of the logger used by Sentry. Defaults to hostname. Optionally set the name usingSENTRY_NAME
environment variable.[logger]
- The name of the Sentry client. Defaults to ''.[release]
- The version/release of your application. Defaults to ''. Optionally set the release usingSENTRY_RELEASE
environment variable.[environment]
- The environment name of your application. Defaults to ''. Optionally set the environment usingSENTRY_ENVIRONMENT
environment variable.
[captureUncaught]
- Enable global error handling. Defaults tofalse
.
Tags
Because Hapi tags are an array of strings and Sentry expects tags to be a k/v map, good-sentry
sets all tags associated with an event to tag: true
pairs. Those are nicely displayed in the tags section of Sentry web interface:
Example Usage
const Hapi = ;const version = version;const server = ;server; const options = reporters: mySentryReporter: module: 'good-squeeze' name: 'Squeeze' args: log: '*' module: 'good-sentry' args: dsn: 'https://<key>:<secret>@sentry.io/<project>' config: name: 'myAwesomeHapiServer' logger: 'mySentryReporter' release: version environment: processenvNODE_ENV captureUncaught: true ; server;
This example sets up the reporter named mySentryReporter to listen for server events and send them to a Sentry project with additional settings.
License
Released under the MIT license.