jackdpeterson/status-aware 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jackdpeterson/status-aware

Composer 安装命令:

composer require jackdpeterson/status-aware

包简介

Return an aggregated status of underlying services with some debugging information. Useful for API dashboards

README 文档

README

A way to report on the status of your service and its subcomponents.

The overall goal of this module is to make reporting on the status of sub-components of an API developer-friendly and non-intrusive. It is anticipated that the primary consumer of those data provided by this module would be a user-friendly dashboard or a service like Pingdom.

Stability note

This module is NOT ready for production. While it probably won't have any major issues ... unit tests have not yet been written. Nor have edge-cases been sorted out when actually using this module.

Installation

composer.json require section:

"jackdpeterson/status-aware" : "dev-master"

Edit config/application.config.php:

return array (
    'modules' => array(
        ...
        'StatusAware'
        ...
    )
);

Provide status data

  1. Create a class that implements the StatusAware\StatusInterface interface.
  2. Figure out how you will check for status of the component in question (e.g., a CURL call w/ TIMEOUTS FOR FAILURE HANDLING
  3. return an array like so:
public function getServiceStatus() {
	return array(
		'name' => 'something identifiable',
		'is_critical' => true,
		'status' => 'up',
		'message' => ''
	);
}

reserved fields and their formats in the response array:

'name' => (string) that helps you identify the service/component in question
'status' => (string) 'up','down','degraded'
'is_critical' => (boolean) Is this functionality critical to your API? If down then the overall status will be 'down'. 
'message' => '' => if 'up', the message is expected to be blank, ''. Otherwise it is assumed that you will provide a useful debugging message about the condition of soft-failure or hard-failure.

Providing additional status data

You can certainly provide more information in the getServiceStatus() array like stack traces ... so long as you cast the data as a string.

Get status data

perform an HTTP GET request to /status will respond with JSON data about the status.

Important and worth re-emphasizing:

Set timeouts on your responses and handle exceptions. Otherwise if something is down ... this may not return anything!

统计信息

  • 总下载量: 23.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: 未知许可证
  • 更新时间: 2015-09-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固