basecamp/easymon — pull request #9 by anoldguy (2014-06-23 23:11:04+00:00)
Title: Issue 8

# Overview
As stated in #8, we're losing visibility into the results of a nested checklist. Specifically, this is biting us on the critical checklists. In order to parse meaningful data out of the checklist responses, we need to get all of the checks returning JSON.

# Direction
I decided that flattening out all of the checks would give us the numbers we need. I'm doing this by adding a `:critical` property to the checks rather than placing the critical checks into their own list. This allows us to still segregate all of the critical checks into `/up/critical` by relying on the ChecksController#show method to run all of the critical checks if it's asked for. Under the covers it does this by creating a Checklist consisting of the critical checks and running it just like it used to. Then it can use the built-in JSON routines to give us the data we need.

This also means we're returning slightly different JSON now. There's a "critical" key, with the check's criticality included with each check.
````JSON
{
"timing": "3.568",
"redis": {
"success": true,
"message": "Up",
"timing": "0.987",
"critical": false
},
"database": {
"success": true,
"message": "Up",
"timing": "0.436",
"critical": true
},
"elasticsearch-http": {
"success": false,
"message": "Down",
"timing": "0.905",
"critical": false
}
}
````

## Concerns
I'm not sure if passing the "critical" flag around like I'm doing is a good thing, but since it's internal to the engine, it's not a huge deal. I'm also bumping the version to 1.2, as the JSON output changed a bit.