Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexeevdv/yii2-health
Yii2 module for application health status reporting
https://github.com/alexeevdv/yii2-health
Last synced: about 2 months ago
JSON representation
Yii2 module for application health status reporting
- Host: GitHub
- URL: https://github.com/alexeevdv/yii2-health
- Owner: alexeevdv
- Created: 2019-07-11T07:10:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-12T06:22:41.000Z (about 5 years ago)
- Last Synced: 2024-01-20T04:11:42.057Z (about 1 year ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
yii2-health
==========[![Build Status](https://travis-ci.com/alexeevdv/yii2-health.svg?branch=master)](https://travis-ci.com/alexeevdv/yii2-health)
[![codecov](https://codecov.io/gh/alexeevdv/yii2-health/branch/master/graph/badge.svg)](https://codecov.io/gh/alexeevdv/yii2-health)
![PHP 7.1](https://img.shields.io/badge/PHP-7.1-green.svg)
![PHP 7.2](https://img.shields.io/badge/PHP-7.2-green.svg)
![PHP 7.3](https://img.shields.io/badge/PHP-7.3-green.svg)Yii2 module for application health status reporting
Installation:
-------------The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist alexeevdv/yii2-health "^1.0"
```or add
```
"alexeevdv/yii2-health": "^1.0"
```to the require section of your composer.json.
Configuration:
--------------```php
//...
'modules' => [
'health' => [
'class' => alexeevdv\yii\health\Module::class,
'components' => [
'database' => alexeevdv\yii\health\components\Database::class,
'queue' => [
'class' => alexeevdv\yii\health\components\Queue::class,
'failoverTimeout' => 600, // default is 300
],
],
],
],
'components' => [
// ...
'queue' => [
// Add this to enable last executed job timestamp logging
'as health' => alexeevdv\yii\health\behaviors\QueueBehavior::class,
],
'urlManager' => [
'rules' => [
// Add url rule to access health status report
'api/v1/health' => '/health',
],
],
// ...
],
//...```
Usage:
------```
$ curl http://localhost/api/v1/health
{
"status": "warn",
"checks": {
"database": [
{
"type": "datastore",
"status": "pass",
"time": "2019-07-09T07:32:10+0000",
"output": ""
}
],
"queue": [
{
"type": "component",
"status": "warn",
"time": "2019-07-09T07:32:10+0000",
"output": "No jobs were executed yet"
}
]
}
}
```Supported components:
--------------------* Database
Class: [alexeevdv\yii\health\components\Database](src/components/Database.php)
Params:
* `db` - Database component configuration* Queue
Class: [alexeevdv\yii\health\components\Queue](src/components/Queue.php)
Params:
* `cache` - Cache component configuration
* `lastExecutedJobCacheKey` - Cache key for last executed job timestamp
* `failoverTimeout` - Second from last executed job for queue to be reported as failed