官术网_书友最值得收藏!

The Health Check protocol and wire format

The MP-HC specification defines the requirement to support the HTTP GET requests against a logical /health REST endpoint that may return any one of the following codes to represent the endpoint's status:

  • 200: It is up and healthy.
  • 500: It is unhealthy due to an unknown error.
  • 503: It is down and not ready to respond to requests.

Note that many cloud environments simply look at the request return code as either success or failure, so the differentiation between a 500 and 503 code may not be distinguishable.

The payload of a /health request must be a JSON object that matches the schema given in the following (for more information on the JSON schema syntax see http://jsonschema.net/#/).

Following is the JSON schema for MicroProfile Health Check responses:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"outcome": {
"type": "string"
},
"checks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string|boolean|int"
}
}
}
},
"required": [
"name",
"state"
]
}
}
},
"required": [
"outcome",
"checks"
]
}

So, an MP-HC response consists of a JSON object that contains a status property of the string type and a checks property of the array of objects type. The checks array object type consists of a required name and status string, along with an optional data object that contains optional key and value pairs. In the next section, we will see how a microservice specifies a health check response.

主站蜘蛛池模板: 鞍山市| 隆林| 宁陕县| 庆阳市| 定陶县| 洪洞县| 华蓥市| 阜城县| 兰考县| 清原| 秭归县| 马边| 饶阳县| 淅川县| 始兴县| 加查县| 贡嘎县| 修文县| 曲周县| 陵川县| 抚顺市| 广西| 思茅市| 武宣县| 上思县| 洪湖市| 崇仁县| 海阳市| 特克斯县| 丽水市| 湟源县| 嘉义市| 马尔康县| 五指山市| 盘山县| 获嘉县| 钦州市| 攀枝花市| 巢湖市| 鱼台县| 佛学|