github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/health/health.go (about)

     1  package health
     2  
     3  // Condition represents an aspect of pyroscope server health.
     4  type Condition interface {
     5  	Probe() (StatusMessage, error)
     6  }
     7  
     8  type StatusMessage struct {
     9  	Status
    10  	// The message is displayed to users.
    11  	Message string
    12  }
    13  
    14  type Status int
    15  
    16  const (
    17  	NoData Status = iota
    18  	Healthy
    19  	Warning
    20  	Critical
    21  )
    22  
    23  func (s Status) String() string {
    24  	switch s {
    25  	case Healthy:
    26  		return "Healthy"
    27  	case Warning:
    28  		return "Warning"
    29  	case Critical:
    30  		return "Critical"
    31  	default:
    32  		return "Unknown"
    33  	}
    34  }