Documentation
¶
Index ¶
- func GetLoggerFromContext(rq *http.Request, fallback *zap.SugaredLogger) *zap.SugaredLogger
- func NewHealth(log *zap.Logger, basePath string, healthChecks ...HealthCheck) (*restful.WebService, error)
- func NewVersion(name string, basePath string) *restful.WebService
- func RequestLoggerFilter(logger *zap.SugaredLogger) restful.FilterFunction
- func UserAuth(ug security.UserGetter, fallbackLogger *zap.SugaredLogger) restful.FilterFunction
- type HealthCheck
- type HealthResponse
- type HealthResult
- type HealthStatus
- type Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLoggerFromContext ¶ added in v0.10.0
func GetLoggerFromContext(rq *http.Request, fallback *zap.SugaredLogger) *zap.SugaredLogger
func NewHealth ¶
func NewHealth(log *zap.Logger, basePath string, healthChecks ...HealthCheck) (*restful.WebService, error)
NewHealth returns a webservice for healthchecks. All checks are executed and returned in a service health map.
func NewVersion ¶
func NewVersion(name string, basePath string) *restful.WebService
NewVersion returns a webservice which returns version information. The given name should be a descriptive name of the module.
func RequestLoggerFilter ¶ added in v0.10.0
func RequestLoggerFilter(logger *zap.SugaredLogger) restful.FilterFunction
func UserAuth ¶
func UserAuth(ug security.UserGetter, fallbackLogger *zap.SugaredLogger) restful.FilterFunction
Types ¶
type HealthCheck ¶
type HealthCheck interface { // ServiceName returns the name of the service that is health checked. ServiceName() string // Check is a function returning a service status and an error. Check(ctx context.Context) (HealthStatus, error) }
HealthCheck defines an interface for health checks.
type HealthResponse ¶ added in v0.9.0
type HealthResponse struct { // Status indicates the overall health state. Status HealthStatus `json:"status"` // Message gives additional information on the overall health state. Message string `json:"message"` // Services is map of services by name with their individual health results. Services map[string]HealthResult `json:"services"` }
HealthResponse is returned by the API when executing a health check.
type HealthResult ¶ added in v0.9.0
type HealthResult struct { // Status indicates the health of the service. Status HealthStatus `json:"status"` // Message gives additional information on the health of a service. Message string `json:"message"` }
HealthResult holds the health state of a service.
type HealthStatus ¶
type HealthStatus string
HealthStatus indicates the health of a service.
const ( // HealthStatusHealthy is returned when the service is healthy. HealthStatusHealthy HealthStatus = "healthy" // HealthStatusUnhealthy is returned when the service is not healthy. HealthStatusUnhealthy HealthStatus = "unhealthy" // HealthStatusDegraded is returned when the service is degraded. HealthStatusDegraded HealthStatus = "degraded" // HealthStatusPartiallyUnhealthy is returned when the service is partially not healthy. HealthStatusPartiallyUnhealthy HealthStatus = "partial-outage" )
func DeriveOverallHealthStatus ¶ added in v0.9.0
func DeriveOverallHealthStatus(services map[string]HealthResult) HealthStatus
Click to show internal directories.
Click to hide internal directories.