Documentation ¶
Index ¶
- Constants
- func NoopReadyChecker() error
- func RoutesToObserve() []string
- type Handler
- func (h *Handler) Alive(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) Ready(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) SetRoutes(r *httprouter.Router)
- func (h *Handler) Version(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
- type ReadyChecker
Constants ¶
const ( AliveCheckPath = "/health/alive" ReadyCheckPath = "/health/ready" VersionPath = "/version" )
Variables ¶
This section is empty.
Functions ¶
func NoopReadyChecker ¶
func NoopReadyChecker() error
func RoutesToObserve ¶
func RoutesToObserve() []string
Types ¶
type Handler ¶
type Handler struct { H herodot.Writer VersionString string ReadyChecks map[string]ReadyChecker }
func NewHandler ¶
func (*Handler) Alive ¶
func (h *Handler) Alive(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route GET /health/alive health isInstanceAlive
Check alive status ¶
This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working.
If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set.
Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
Produces: - application/json Responses: 200: healthStatus 500: genericError
func (*Handler) Ready ¶
func (h *Handler) Ready(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route GET /health/ready health isInstanceReady
Check readiness status ¶
This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well.
If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set.
Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
Produces: - application/json Responses: 200: healthStatus 503: healthNotReadyStatus
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(r *httprouter.Router)
func (*Handler) Version ¶
func (h *Handler) Version(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route GET /version version getVersion
Get service version ¶
This endpoint returns the service version typically notated using semantic versioning.
If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set.
Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
Produces: - application/json Responses: 200: version
type ReadyChecker ¶
type ReadyChecker func() error