MCPcopy Index your code
hub / github.com/cortexproject/cortex / LivenessCheck

Method LivenessCheck

pkg/ruler/ruler.go:607–618  ·  view source on GitHub ↗
(_ context.Context, request *LivenessCheckRequest)

Source from the content-addressed store, hash-verified

605}
606
607func (r *Ruler) LivenessCheck(_ context.Context, request *LivenessCheckRequest) (*LivenessCheckResponse, error) {
608 if r.lifecycler.ServiceContext() == nil {
609 return nil, errors.New("ruler is not yet ready")
610 }
611 if r.lifecycler.ServiceContext().Err() != nil || r.subservices.IsStopped() {
612 return nil, errors.New("ruler's context is canceled and might be stopping soon")
613 }
614 if !r.subservices.IsHealthy() {
615 return nil, errors.New("not all subservices are in healthy state")
616 }
617 return &LivenessCheckResponse{State: int32(r.State())}, nil
618}
619
620// This function performs a liveness check against the provided replicas. If any one of the replicas responds with a state = Running, then
621// this Ruler should not take ownership of the rule group. Otherwise, this Ruler must take ownership of the rule group to avoid missing evaluations

Callers

nothing calls this directly

Calls 5

ServiceContextMethod · 0.80
IsStoppedMethod · 0.80
ErrMethod · 0.65
StateMethod · 0.65
IsHealthyMethod · 0.45

Tested by

no test coverage detected