An executable which launches a program, awaiting its exit. In the event of a go panic, it is automatically reported to Bugsnag.
go install github.com/bugsnag/panic-monitor@latest
Set your Bugsnag API key as the environment variable BUGSNAG_API_KEY
, then
launch your program
panic-monitor PROGRAM [PROGRAM arguments]
Detect when a program was launched via panic-monitor by the presence of the
environment variable BUGSNAG_PANIC_MONITOR
.
Override the default values in the monitor through environment variables:
Key | Value |
---|---|
BUGSNAG_API_KEY | (required) Your API key, available on the Bugsnag dashboard |
BUGSNAG_APP_TYPE | Application component, like a router, mailer, or queue |
BUGSNAG_APP_VERSION | Current version of the application |
BUGSNAG_NOTIFY_ENDPOINT | Event Server address for Bugsnag On-premise |
BUGSNAG_HOSTNAME | Device hostname |
BUGSNAG_NOTIFY_RELEASE_STAGES | Comma-delimited list of release stages to notify in |
BUGSNAG_PROJECT_PACKAGES | Comma-delimited list of Go packages to be considered a part of the application |
BUGSNAG_RELEASE_STAGE | The deployment stage of the application, like "production" or "beta" or "staging" |
BUGSNAG_SOURCE_ROOT | The directory where source packages are built and the assumed prefix of package directories |
Add metadata through environment variables prefixed with BUGSNAG_METADATA_
.
The environment variable name after the prefix is expected to be the tab and key name, delimited by an underscore.
Examples:
BUGSNAG_METADATA_device_KubePod="carrot-delivery-service-beta1 reg3"
BUGSNAG_METADATA_device_deployment_area=region5_1
Would add the following metadata to the device
tab in the event of a panic:
KubePod
:carrot-delivery-service-beta1 reg3
deployment_area
:region5_1
Build one of the example crashing apps using go build
:
go build features/fixtures/app
Then run it using the monitor:
export BUGSNAG_API_KEY="your-api-key-here"
TESTCASE="explicit panic" panic-monitor ./app
Run the unit tests via go test
The integration tests depend on cucumber, available through Ruby bundler:
bundle install
bundle exec cucumber