Skip to content

Commit

Permalink
chore: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
commoddity committed Sep 10, 2024
1 parent 97d056f commit e651297
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions router/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,32 @@ const (
statusNotReady healthCheckStatus = "initializing"
)

// HealthCheckComponent is an interface that must be implemented
// by components that need to report their health status
type HealthCheckComponent interface {
Name() string
IsReady() bool
}

type (
HealthCheckComponent interface {
Name() string
IsReady() bool
healthCheck struct {
components []HealthCheckComponent
logger polylog.Logger
}
healthCheckJSON struct {
Status healthCheckStatus `json:"status"`
ImageTag string `json:"imageTag"`
ReadyStates map[string]bool `json:"readyStates,omitempty"`
}
)
type healthCheck struct {
components []HealthCheckComponent
logger polylog.Logger
}

// healthCheckHandler returns the health status of PATH as a JSON response.
//
// It will return a 200 OK status code if all components are ready or
// a 503 Service Unavailable status code if any component is not ready.
//
// The image tag is set to the value of the IMAGE_TAG environment variable, which is
// passed to the Docker image as a build argument at build time.
func (c *healthCheck) healthCheckHandler(w http.ResponseWriter, req *http.Request) {
readyStates := c.getComponentReadyStates()
status := getStatus(readyStates)
Expand Down

0 comments on commit e651297

Please sign in to comment.