mesosphere/marathon — pull request #206 by ConnorDoyle (2014-03-29 00:08:46+00:00)
Title: HTTP and TCP Per-Task Health Checks

**Do not merge**: _For initial review_

Addresses #174
Supersedes PR #188

**Known issues:**

- Health status should be reported via the JSON returned by the REST API
- `ActorLogging` should be replaced with a logger consistent with the rest of the app
- Events should be posted to the event bus:
- health check added
- health check removed
- health check failed
- health status changed

Health checks look like this inside of an `AppDefinition`:

```javascript
{
// ...

"healthChecks": [
{
"protocol": "HTTP",
"acceptableResponses": [200],
"path": "/health",
"initialDelaySeconds": 10,
"intervalSeconds": 5,
"portIndex": 0,
"timeoutSeconds": 10
},
{
"protocol": "TCP",
"initialDelaySeconds": 10,
"intervalSeconds": 5,
"portIndex": 0,
"timeoutSeconds": 10
}
]
}
```

The status of each health check is reported internally as follows for each active task:

```scala
case class Health(
taskId: String,
lastSuccess: Option[Timestamp] = None,
lastFailure: Option[Timestamp] = None,
lastFailureCause: Option[String] = None,
consecutiveFailures: Int = 0
)
```