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' ] ]Prerequisites
Section titled “Prerequisites”Check-in options
Section titled “Check-in options”| Field name | Required |
|---|---|
name | No. |
slug | Yes. This is the identifier used to synchronize check-ins. |
schedule_type | Yes. |
report_period | Only when 'schedule_type' => 'simple'. |
cron_schedule | Only when 'schedule_type' => 'cron'. |
cron_timezone | Only when 'schedule_type' => 'cron'. |
grace_period | No. |
You can find more details in the Checkins API page.
Synchronization
Section titled “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.
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:
$ php artisan honeybadger:checkins:syncCheckins 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 |+--------+---------------------------------------+---------------+--------------+-----------------+Validation
Section titled “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 artisan command:
php artisan honeybadger:checkins:sync || trueTroubleshooting
Section titled “Troubleshooting”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.