devolicious/oh-dear-app-health-bundle
Composer 安装命令:
composer require devolicious/oh-dear-app-health-bundle
包简介
A simple Symfony bundle to integrate OhDear Application Health monitoring
README 文档
README
A simple Symfony bundle to integrate OhDear Application Health monitoring.
Installation
Step 1: Download the Bundle
composer require devolicious/oh-dear-app-health-bundle
if you are using Symfony Flex, the bundle will be automatically enabled. Otherwise, enable it by adding it to your bundles.php file.
// bundles.php return [ // ... Devolicious\OhDearAppHealthBundle\OhDearAppHealthBundle::class => ['all' => true], ];
Step 2: Configure the routes
add this to your config/routes.yaml file:
_health_check: resource: '@OhDearAppHealthBundle/Resources/config/routing.yaml'
or if you want to customize the route, just add your own route yaml file in config/routes/ containing the following:
my_custom_health_check: path: /my-custom-health-check-route controller: Devolicious\OhDearAppHealthBundle\Controller\HealthController methods: [GET, HEAD]
How to use it
Create your own checkers by implementing the Devolicious\OhDearAppHealthBundle\Checker\CheckerInterface and tag them with oh_dear_app_health.checker:
# config/services.yaml services: _instanceof: ... Devolicious\OhDearAppHealthBundle\Checker\CheckerInterface: tags: [ 'oh_dear_app_health.checker' ]
That's it! Your checkers will be automatically executed when the health check route is called.
But, you're also able to cache the result of your checkers. When you run the command health:check all your checkers
will run and by default it will be stored in the default cache pool. You can change this overriding the ResultStore interface with any service implementing it.
services: ... # default configuration (already configured in the bundle) Devolicious\OhDearAppHealthBundle\Store\RequestStore: '@Devolicious\OhDearAppHealthBundle\Store\CachePoolStore' # custom configuration Devolicious\OhDearAppHealthBundle\Store\RequestStore: '@App\Store\MyCustomStore'
Within each checker you can define the frequency of how often the check should be executed in seconds.
Built-in checkers
DoctrineDatabaseChecker
This checker is included in the library. It is not enabled by default as you might not need it or you are using a different database configuration.
It also enables to reuse the checker when having multiple database connections. Assuming you have added the _instanceof configuration as described above, you can add the following to your services.yaml file:
# config/services.yaml services: ... # Example for simple setup with 1 database connection and autowire enabled Devolicious\OhDearAppHealthBundle\Checker\DoctrineConnectionChecker: ~
If you have multiple database connections, you can add the following to your services.yaml file:
# config/services.yaml services: ... # Example for default connection with MySQL app.mysql_database_checker: class: Devolicious\OhDearAppHealthBundle\Checker\DoctrineConnectionChecker arguments: - '@doctrine.orm.default_entity_manager' - 'MySQL Database' #optional, defaults to 'Database' # Example for an extra connection with a MSSQL database app.mssql_database_checker: class: Devolicious\OhDearAppHealthBundle\Checker\DoctrineConnectionChecker arguments: - '@doctrine.orm.mssql_entity_manager' - 'MSSQL Database' #optional, defaults to 'Database'
devolicious/oh-dear-app-health-bundle 适用场景与选型建议
devolicious/oh-dear-app-health-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 844 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 devolicious/oh-dear-app-health-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devolicious/oh-dear-app-health-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 844
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-14