Trait surf_disco::client::HealthCheck
pub trait HealthCheck: Serialize {
// Required method
fn status(&self) -> StatusCode;
}
Expand description
A response to a healthcheck endpoint.
A type implementing HealthCheck may be returned from a healthcheck endpoint itself (via its
Serialize implementation) as well as incorporated automatically into the global healthcheck
endpoint for an app. The global healthcheck will fail if any of the module healthchecks return
an implementation h
of HealthCheck where h.status() != StatusCode::OK
.
We provide a standard implementation HealthStatus which has variants for common states an application might encounter. We recommend using this implementation as a standard, although it is possible to implement the HealthCheck trait yourself if you desire more information in your healthcheck response.
Required Methods§
fn status(&self) -> StatusCode
fn status(&self) -> StatusCode
The status of this health check.
Should return StatusCode::OK if the status is considered healthy, and some other status code if it is not.