alphagov/publisher — pull request #228 by fatbusinessman (2014-07-04 11:15:00+00:00)
Title: Add a health check

As well as the usual function of a `/healthcheck` endpoint – to return a `200` response whenever the app is up and running – this adds an application-level check that the scheduled publishing queue has the right number of items in it. We should be able to add a monitoring check for this, and any other checks we decide to add, without having to couple the monitoring stack to our application logic.

Example output when everything’s ok:

```json
{
"checks": {
"schedule_queue": {
"status": "ok"
}
},
"status": "ok"
}
```

When it isn’t:

```json
{
"checks": {
"schedule_queue": {
"message": "3 scheduled editions; 2 items queued",
"status": "warning"
}
},
"status": "warning"
}
```