Skip to content

Configuring check-ins

Honeybadger’s PHP and Laravel packages allow configuring Check-Ins via the checkins configuration key. Create, update or even remove check-ins for your project(s) by defining them in your configuration file. If you are using Laravel or Lumen, this should be in your config/honeybadger.php file.

'api_key' => env('HONEYBADGER_API_KEY'),
'personal_auth_token' => env('HONEYBADGER_PERSONAL_AUTH_TOKEN'),
'checkins' => [
[
'schedule_type' => 'simple',
'name' => 'Hourly clean up',
'slug' => 'hourly-clean-up',
'grace_period' => '5 minutes',
'report_period' => '1 hour'
],
[
'schedule_type' => 'cron',
'name' => 'Hourly check',
'slug' => 'hourly-check',
'cron_schedule' => '30 * * * *',
'cron_timezone' => 'UTC'
]
]
Field nameRequired
nameNo.
slugYes. This is the identifier used to synchronize check-ins.
schedule_typeYes.
report_periodOnly when 'schedule_type' => 'simple'.
cron_scheduleOnly when 'schedule_type' => 'cron'.
cron_timezoneOnly when 'schedule_type' => 'cron'.
grace_periodNo.

You can find more details in the Checkins API page.

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.

If you are on Laravel or Lumen, you can do this by adding the honeybadger:checkins:sync command as an additional step to your deployment. Otherwise, you can manually create a script and run it:

<?php
require __DIR__.'/vendor/autoload.php';
$configString = file_get_contents(__DIR__.'/config/honeybadger.php');
$config = json_decode($configString, true);
(new \Honeybadger\CheckinsManager($config))->sync($config['checkins']);

The output of the command will print out created, updated or removed check-ins:

Terminal window
$ php artisan honeybadger:checkins:sync
Checkins were synchronized with Honeybadger.
+--------+---------------------------------------+---------------+--------------+-----------------+
| Id | Name | Schedule Type | Grace Period | Status |
+--------+---------------------------------------+---------------+--------------+-----------------+
| yaI6Pr | Weekly Exports | simple | 5 minutes | Synchronized |
| b3Ip54 | Hourly Notifications | simple | 5 minutes | Synchronized |
| l2Ie8Q | Hourly SMS Notifications (deprecated) | simple | 5 minutes | Removed |
+--------+---------------------------------------+---------------+--------------+-----------------+

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 artisan command:

Terminal window
php artisan honeybadger:checkins:sync || true

If you are receiving invalid API key errors, make sure you have set both api_key and personal_auth_token in your configuration file. If you are still receiving invalid API key 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.