Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Error class for this package. Error = errs.Class("healthcheck") // ErrCheckExists is returned when a check with the same name already exists. ErrCheckExists = Error.New("check with name already exists") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Enabled bool `help:"Whether the health check server is enabled" default:"false"` Address string `help:"The address to listen on for health check server" default:":10500"` }
Config is the configuration for healthcheck server.
type HealthCheck ¶
type HealthCheck interface { // Healthy returns true if the service is healthy. Healthy(ctx context.Context) bool // Name returns the name of the service being checked. Name() string }
HealthCheck is an interface that defines the methods for a health check.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles HTTP request for health Server.
func (*Server) AddCheck ¶
func (s *Server) AddCheck(check HealthCheck) error
AddCheck adds a health check to the server.
func (*Server) TestGetAddress ¶
TestGetAddress returns the address of this server for tests.
Click to show internal directories.
Click to hide internal directories.