Check-Ins
Usage
Check-Ins are only available for JavaScript running on the server.
The Honeybadger JavaScript client comes with a helper method checkIn()
, that allows to ping Honeybadger from inside the code. You can read more about check-ins here.
Usage is pretty simple:
await Honeybadger.checkIn('Slug_or_ID')
Configuration
Honeybadger's JavaScript packages allow configuring Check-Ins via a configuration file.
Simply add a honeybadger.config.js
or honeybadger.config.ts
in your project's root folder.
Here's a sample configuration file:
// honeybadger.config.js
module.exports = {
apiKey: process.env.HONEYBADGER_API_KEY,
personalAuthToken: process.env.HONEYBADGER_PERSONAL_AUTH_TOKEN,
checkins: [
{
scheduleType: 'simple',
name: 'Hourly clean up',
slug: 'hourly-clean-up',
gracePeriod: '5 minutes',
reportPeriod: '1 hour'
},
{
scheduleType: 'cron',
name: 'Hourly check',
slug: 'hourly-check',
cronSchedule: '30 * * * *',
cronTimezone: 'UTC'
}
]
}
Prerequisites
Check-ins are project specific, so you need to set the apiKey
of the project you want to create check-ins for.
A personalAuthToken
is required to create, update or remove check-ins. You can find this token
under the authentication tab in your User Settings page.
Check-in Options
Field name | Required |
---|---|
name |
No. |
slug |
Yes. This is the identifier used to synchronize check-ins. |
scheduleType |
Yes. |
reportPeriod |
Only when scheduleType: 'simple' . |
cronSchedule |
Only when scheduleType: 'cron' . |
cronTimezone |
Only when scheduleType: 'cron' . |
gracePeriod |
No. |
You can find more details in the Check-Ins API page.
Synchronization
Once you have configured your check-ins, they need to be synchronized with Honeybadger. Usually you would do this as part of your deployment pipeline.
Simply add the following command to your deployment pipeline:
npx honeybadger-checkins-sync
The output of the command will print out created, updated or removed check-ins:
$ npx honeybadger-checkins-sync
Checkins were synchronized with Honeybadger.
┌─────────┬──────────┬─────────────────────────────────────────┬───────────────┬───────────────┬──────────────┬───────────────────┐
│ (index) │ Id │ Name │ Schedule Type │ Report Period │ Grace Period │ Status │
├─────────┼──────────┼─────────────────────────────────────────┼───────────────┼───────────────┼──────────────┼───────────────────┤
│ 0 │ 'yaI6Pr' │ 'Weekly Exports' │ 'simple' │ '1 week' │ '10 minutes' │ '✅ Synchronized' │
│ 1 │ '83Id8v' │ 'Hourly Notifications' │ 'simple' │ '1 hour' │ '5 minutes' │ '✅ Synchronized' │
│ 3 │ 'l2Ie8Q' │ 'Hourly SMS Notifications (deprecated)' │ 'simple' │ '1 hour' │ '5 minutes' │ '❌ Removed' │
└─────────┴──────────┴─────────────────────────────────────────┴───────────────┴───────────────┴──────────────┴───────────────────┘
Validation
The synchronization process will validate the check-ins before sending them to Honeybadger. If any of the check-ins are invalid, the synchronization will fail and most probably the deployment pipeline will fail. If you want to avoid this behavior, you can ignore the result of the command:
npx honeybadger-checkins-sync || true
Troubleshooting
If you are receiving invalid API key errors, make sure you have set both apiKey
and personalAuthToken
in your configuration file.
If you are still receiving errors, it is possible that you have reached your check-in limit or you are trying to create a check-in that is not supported by your plan.