feat: add opt-in application health checks with Oh Dear integration#126
Merged
ManukMinasyan merged 9 commits intomainfrom Feb 16, 2026
Merged
feat: add opt-in application health checks with Oh Dear integration#126ManukMinasyan merged 9 commits intomainfrom
ManukMinasyan merged 9 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in application health checking system using Spatie Laravel Health, with optional Oh Dear reporting, intended to be disabled by default and enabled via environment/config.
Changes:
- Introduces
HealthServiceProviderthat registers 15 Spatie health checks whenHEALTH_CHECKS_ENABLEDis enabled. - Adds Spatie Health configuration (in-memory result store) and Oh Dear endpoint configuration.
- Adds scheduling for health check commands and a basic feature test to verify checks are gated by configuration.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
app/Providers/HealthServiceProvider.php |
Registers the suite of health checks behind an enable flag. |
bootstrap/providers.php |
Adds the new HealthServiceProvider to the app’s provider list. |
routes/console.php |
Schedules Spatie Health commands when health checks are enabled. |
config/health.php |
Adds Spatie Health + Oh Dear endpoint configuration. |
config/app.php |
Adds health_checks_enabled config flag backed by HEALTH_CHECKS_ENABLED. |
tests/Feature/HealthChecks/HealthServiceProviderTest.php |
Verifies checks are registered only when enabled. |
.env.example |
Documents opt-in env vars for health checks / Oh Dear secret. |
composer.json |
Adds Spatie health packages (health, cpu-load check, security advisories check). |
composer.lock |
Locks newly added dependencies. |
Comments suppressed due to low confidence (2)
routes/console.php:14
- This project already centralizes scheduled tasks in
bootstrap/app.phpvia->withSchedule(...). Adding scheduling logic inroutes/console.phpsplits scheduling configuration across two locations, making it easier to miss tasks during future maintenance. Consider moving theseSchedule::command(...)registrations into the existingwithScheduleclosure (still gated byconfig('app.health_checks_enabled')).
config/health.php:82 - The comment block starting here is not indented like the rest of the config file and uses a PHPDoc-style
/** ... */block inside an array, which is inconsistent with the surrounding config comment style. Align the indentation and use the same/* ... */style used elsewhere inconfig/*for consistency (and ensure the commented config line would be syntactically correct if uncommented).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spatie/laravel-healthwith CPU load and security advisories checksHealthServiceProvidergated behindHEALTH_CHECKS_ENABLEDenv var (default: off)InMemoryHealthResultStore(no migration needed)OH_DEAR_HEALTH_CHECK_SECRETis setChecks included
DatabaseConnection, DatabaseConnectionCount, DatabaseSize, DatabaseTableSize, Redis, RedisMemoryUsage, Horizon, Queue, UsedDiskSpace, CpuLoad, DebugMode, Environment, Schedule, SecurityAdvisories, ApplicationCache
Test plan
HEALTH_CHECKS_ENABLEDis unset/false