Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not merge [issue #110] Wireformat checks property as object, not array, keyed… #156

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion spec/src/main/asciidoc/java-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public class SuccessfulCheck implements HealthCheck {
The `name` is used to tell the different checks apart when a human operator looks at the responses.
It may be that one check of several fails and it's useful to know which one.

The names are required to be unique within the context of application deployment.

`HealthCheckResponse` 's also support a free-form information holder, that can be used to supply arbitrary data to the consuming end:

```
Expand Down Expand Up @@ -121,4 +123,4 @@ class MyChecks {
return () -> HealthStatus.state(getCpuUsage() < 0.9);
}
}}
```
```
116 changes: 56 additions & 60 deletions spec/src/main/asciidoc/protocol-wireformat.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Each provider MUST provide the REST/HTTP interaction, but MAY provide other prot
* Producer MUST support JSON encoded payload with simple UP/DOWN states
* Producers MAY support an additional information holder with key/value pairs to provide further context (i.e. disk.free.space=120mb).
* The JSON response payload MUST be compatible with the one described in Appendix B
* The JSON response MUST contain the `name` entry specifying the name of the check, to support protocols that support external identifier (i.e. URI)
* The JSON response MUST contain the `name` entry specifying the name of the check, to support protocols that support external identifier (i.e. URI). This name MUST be unique within the context of the application.
* The JSON response MUST contain the `status` entry specifying the state as String: “UP” or “DOWN”
* The JSON MAY support an additional information holder to carry key value pairs that provide additional context

Expand All @@ -143,7 +143,7 @@ When multiple procedures are installed all procedures MUST be executed and the o

==== Executing procedures

When executing health check procedures a producer MUST handle any unchecked exceptions and synthesize a substitute respone.
When executing health check procedures a producer MUST handle any unchecked exceptions and synthesize a substitute response.

* The synthesized response MUST contain a `status` entry with a value of "DOWN".
* The synthesized response MUST contain a `name` entry with a value set to the runtime class name of the failing check.
Expand Down Expand Up @@ -216,46 +216,47 @@ The following table give valid health check responses:

```
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"checks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string|boolean|int"
}
}
}
},
"required": [
"name",
"status"
]
}
}
},
"required": [
"status",
"checks"
]
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"checks": {
"type": "object",
"patternProperties": {
"^.*$": {
"properties": {
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": [
"string",
"boolean",
"integer"
]
}
}
}
}
}
}
}
},
"required": [
"status",
"checks"
]
}
```
(See http://jsonschema.net/#/)
Expand All @@ -268,16 +269,15 @@ Status `200` and the following payload:
```
{
"status": "UP",
"checks": [
{
"name": "myCheck",
"checks": {
"myCheck": {
"status": "UP",
"data": {
"key": "value",
"foo": "bar"
}
}
]
}
}
```

Expand All @@ -286,40 +286,36 @@ Status `503` and the following payload:
```
{
"status": "DOWN",
"checks": [
{
"name": "firstCheck",
"checks": {
"firstCheck": {
"status": "DOWN",
"data": {
"key": "value",
"foo": "bar"
}
},
{
"name": "secondCheck",
"secondCheck": {
"status": "UP"
}
]
}
}
```

Status 500
```
{
"status": "DOWN",
"checks": [
{
"name": "example.health.FirstCheck",
"checks": {
"example.health.FirstCheck": {
"status": "DOWN",
"data": {
"rootCause": "timed out waiting for available connection"
}
},
{
"name": "secondCheck",
"secondCheck": {
"status": "UP"
}
]
}
}
```

Expand All @@ -330,7 +326,7 @@ Status `200` and the following payload:
```
{
"status": "UP",
"checks": []
"checks": {}
}
```

Expand All @@ -341,6 +337,6 @@ Status `503` and the following payload:
```
{
"status": "DOWN",
"checks": []
"checks": {}
}
```