Documentation ¶
Index ¶
Constants ¶
const ( // DefaultTolerance is the default time (in seconds) allowed between heartbeats. DefaultTolerance = time.Second * 30 // ToleranceHeader is the HTTP header name used to override a collector's configured tolerance. ToleranceHeader = "X-Liveness-Tolerance" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
Check is a heartbeat style liveness reporter.
It is not guaranteed to be safe to CheckIn across multiple goroutines. IsLive must be safe to be called concurrently with CheckIn.
type CheckCollector ¶
type CheckCollector struct {
// contains filtered or unexported fields
}
CheckCollector produces multiple checks and returns live only if all decendant checks are live.
Each child check may only be used by one goroutine, the CheckCollector may be used by multiple routines at once to produce checks.
func NewCheckCollector ¶
func NewCheckCollector(tolerance time.Duration) *CheckCollector
NewCheckCollector creates a threadsafe Collector.
func (*CheckCollector) IsLive ¶
func (c *CheckCollector) IsLive(tolerance time.Duration) bool
IsLive checks if we are still live against the given the tolerace between hearbeats.
If tolerance is 0, the default tolerance is used.
func (*CheckCollector) NewCheck ¶
func (c *CheckCollector) NewCheck() Check
NewCheck returns a Check which is safe for use on a single routine.
func (*CheckCollector) Register ¶
func (c *CheckCollector) Register(ck Check)
Register adds a check to a collector
func (*CheckCollector) ServeHTTP ¶
func (c *CheckCollector) ServeHTTP(w http.ResponseWriter, r *http.Request)