Documentation ¶
Index ¶
- Constants
- type HealthAggregator
- func (aggregator *HealthAggregator) RegisterReporter(name string, reports *HealthReport, timeout time.Duration)
- func (aggregator *HealthAggregator) Report(name string, report *HealthReport)
- func (aggregator *HealthAggregator) ServeHTTP(port int)
- func (aggregator *HealthAggregator) Summary() *HealthReport
- type HealthReport
Constants ¶
const ( // The HTTP status that we use for 'ready' or 'live'. 204 means "No Content: The server // successfully processed the request and is not returning any content." (Kubernetes // interpets any 200<=status<400 as 'good'.) StatusGood = 204 // The HTTP status that we use for 'not ready' or 'not live'. 503 means "Service // Unavailable: The server is currently unavailable (because it is overloaded or down for // maintenance). Generally, this is a temporary state." (Kubernetes interpets any // status>=400 as 'bad'.) StatusBad = 503 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthAggregator ¶
type HealthAggregator struct {
// contains filtered or unexported fields
}
A HealthAggregator receives health reports from individual reporters (which are typically components of a particular daemon or application) and aggregates them into an overall health summary. For each monitored kind of health, all of the reporters that report that need to say that it is good; for example, to be 'ready' overall, all of the reporters that report readiness need to have recently said 'Ready: true'.
func NewHealthAggregator ¶
func NewHealthAggregator() *HealthAggregator
func (*HealthAggregator) RegisterReporter ¶
func (aggregator *HealthAggregator) RegisterReporter(name string, reports *HealthReport, timeout time.Duration)
RegisterReporter registers a reporter with a HealthAggregator. The aggregator uses NAME to identify the reporter. REPORTS indicates the kinds of health that this reporter will report. TIMEOUT is the expiry time for this reporter's reports; the implication of which is that the reporter should normally refresh its reports well before this time has expired.
func (*HealthAggregator) Report ¶
func (aggregator *HealthAggregator) Report(name string, report *HealthReport)
Report reports current health from a reporter to a HealthAggregator. NAME is the reporter's name and REPORTS conveys the current status, for each kind of health that the reporter said it was going to report when it called RegisterReporter.
func (*HealthAggregator) ServeHTTP ¶
func (aggregator *HealthAggregator) ServeHTTP(port int)
ServeHTTP publishes the current overall liveness and readiness at http://*:PORT/liveness and http://*:PORT/readiness respectively. A GET request on those URLs returns StatusGood or StatusBad, according to the current overall liveness or readiness. These endpoints are designed for use by Kubernetes liveness and readiness probes.
func (*HealthAggregator) Summary ¶
func (aggregator *HealthAggregator) Summary() *HealthReport
Summary calculates the current overall health for a HealthAggregator.