Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
HealthTimeout = 5 * time.Second
)
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { Engine *gin.Engine AppInfo *health.AppInfo ProjectInfo *health.ProjectInfo //The key is like "/v1" or "/v2" with a leading slash AdditionalHealthData map[string]*health.AdditionalHealthData }
Server is based on Gin https://github.com/gin-gonic/gin
func (*Server) RegisterDetailedHealth ¶
func (s *Server) RegisterDetailedHealth(versionGroup, description string, h *health.AdditionalHealthData)
RegisterDetailedHealth registers detail health at /<versionGroup>/health/detailed versionGroup must be like "/v1", "/v2"..., then the endpoint is "/v1/health/detailed", "/v2/health/detailed"... There should be a leading slash for the versionGroup. If versionGroup is empty string "" or "/", then this detailed health endpoint is not versioned, like "/health/detailed" A detailed health should only check for other service's simple health. Never check the detailed health of a depending service.
func (*Server) RegisterSimpleHealth ¶
func (s *Server) RegisterSimpleHealth()
RegisterSimpleHealth registers /health Simple health is used by the load balancer's health checks and dependent services' detailed health.
func (*Server) UseMiddleware ¶
func (s *Server) UseMiddleware(mw gin.HandlerFunc)