Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/alexliesenfeld/health
/ functions
Functions
122 in github.com/alexliesenfeld/health
⨍
Functions
122
◇
Types & classes
22
↓ 19 callers
Function
NewChecker
NewChecker creates a new Checker. The provided options will be used to modify its configuration. If the Checker was not yet started (see Checker.IsSta
config.go:59
↓ 13 callers
Function
WithCheck
WithCheck adds a new health check that contributes to the overall service availability status. This check will be triggered each time Checker.Check is
config.go:164
↓ 12 callers
Function
NewHandler
NewHandler creates a new health check http.Handler.
handler.go:67
↓ 7 callers
Function
WithPeriodicCheck
WithPeriodicCheck adds a new health check that contributes to the overall service availability status. The health check will be performed on a fixed s
config.go:185
↓ 7 callers
Function
WithTimeout
WithTimeout defines a timeout duration for all checks. You can override this timeout by using the timeout value in the Check configuration. Default va
config.go:85
↓ 6 callers
Function
doTestEvaluateAvailabilityStatus
( t *testing.T, expectedStatus AvailabilityStatus, maxTimeInError time.Duration, maxFails uint, state Che
check_test.go:34
↓ 5 callers
Function
WithStatusListener
WithStatusListener registers a listener function that will be called whenever the overall/aggregated system health status changes (e.g. from "up" to "
config.go:94
↓ 4 callers
Method
Check
Check runs all synchronous (i.e., non-periodic) check functions. It returns the aggregated health status (combined from the results of this executions
check.go:60
↓ 4 callers
Function
WithCacheDuration
WithCacheDuration sets the duration for how long the aggregated health check result will be cached. By default, the cache TTL (i.e, the duration for h
config.go:154
↓ 4 callers
Function
getLogger
(ctx context.Context)
examples/hooks/main.go:86
↓ 3 callers
Function
BasicLogger
BasicLogger is a basic logger that is mostly used to showcase this library.
interceptors/logging.go:11
↓ 3 callers
Method
GetRunningPeriodicCheckCount
GetRunningPeriodicCheckCount returns the number of currently running periodic checks.
check.go:63
↓ 3 callers
Function
WithChecks
WithChecks adds a list of health checks that contribute to the overall service availability status. These checks will be triggered each time Checker.C
config.go:172
↓ 3 callers
Function
WithDisabledAutostart
WithDisabledAutostart disables automatic startup of a Checker instance.
config.go:136
↓ 3 callers
Function
WithMiddleware
WithMiddleware configures a middleware that will be used by the handler to pro- and post-process HTTP requests and health checks. Refer to the documen
config.go:103
↓ 3 callers
Function
aggregateStatus
(results map[string]CheckState)
check.go:548
↓ 3 callers
Function
doTestCheckerCheckFunc
(t *testing.T, updateInterval time.Duration, err error, expectedStatus AvailabilityStatus)
check_test.go:116
↓ 3 callers
Function
doTestHandler
(t *testing.T, statusCodeUp, statusCodeDown int, expectedStatus CheckerResult, expectedStatusCode int)
handler_test.go:50
↓ 2 callers
Method
IsStarted
IsStarted returns true, if the Checker was started (see Checker.Start) and is currently still running. Returns false otherwise.
check.go:66
↓ 2 callers
Method
Start
Start will start all necessary background workers and prepare the checker for further usage.
check.go:50
↓ 2 callers
Method
Stop
Stop stops will stop the checker.
check.go:52
↓ 2 callers
Function
WithDisabledCache
WithDisabledCache disabled the check cache. This is not recommended in most cases. This will effectively lead to a health endpoint that initiates a ne
config.go:146
↓ 2 callers
Function
WithDisabledDetails
WithDisabledDetails disables all data in the JSON response body. The AvailabilityStatus will be the only content. Example: { "status":"down" }. Enable
config.go:76
↓ 2 callers
Function
WithInfo
WithInfo sets values that will be available in every health check result. For example, you can use this option if you want to set information about yo
config.go:207
↓ 2 callers
Function
WithInterceptors
WithInterceptors adds a list of interceptors that will be applied to every check function. Interceptors may intercept the function call and do some pr
config.go:196
↓ 2 callers
Function
WithResultWriter
WithResultWriter is responsible for writing a health check result (see CheckerResult) into an HTTP response. By default, JSONResultWriter will be used
config.go:129
↓ 2 callers
Function
WithStatusCodeDown
WithStatusCodeDown sets an HTTP status code that will be used for responses where the system is considered to be unavailable ("down"). Default is HTTP
config.go:121
↓ 2 callers
Function
WithStatusCodeUp
WithStatusCodeUp sets an HTTP status code that will be used for responses where the system is considered to be available ("up"). Default is HTTP statu
config.go:112
↓ 2 callers
Method
Write
Write writes a CheckerResult into a http.ResponseWriter in a format that the ResultWriter supports (such as XML, JSON, etc.). A ResultWriter is expect
handler.go:41
↓ 2 callers
Method
criticality
()
check.go:184
↓ 2 callers
Function
evaluateCheckStatus
(state *CheckState, maxTimeInError time.Duration, maxFails uint)
check.go:529
↓ 2 callers
Function
executeCheck
( ctx context.Context, cfg *checkerConfig, check *Check, oldState CheckState, )
check.go:447
↓ 2 callers
Function
isPeriodicCheck
(check *Check)
check.go:420
↓ 2 callers
Function
setLogger
(ctx context.Context, logger *log.Entry)
examples/hooks/main.go:82
↓ 2 callers
Method
updateState
(ctx context.Context, updates ...checkResult)
check.go:381
↓ 2 callers
Function
waitForStopSignal
(ctx context.Context, waitTime time.Duration)
check.go:424
↓ 2 callers
Function
withCheckContext
(ctx context.Context, check *Check, f func(checkCtx context.Context))
check.go:438
↓ 1 callers
Function
BasicAuth
BasicAuth is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response on authentication failure. A
middleware/auth.go:19
↓ 1 callers
Function
BasicLogger
BasicLogger is a basic logger that is mostly used to showcase this library.
middleware/logging.go:11
↓ 1 callers
Method
Check
Check implements Checker.Check. Please refer to Checker.Check for more information.
check.go:267
↓ 1 callers
Function
CustomAuth
CustomAuth is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response on authentication failure.
middleware/auth.go:37
↓ 1 callers
Function
FullDetailsOnQueryParam
FullDetailsOnQueryParam is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response unless the req
middleware/filter.go:11
↓ 1 callers
Function
NewJSONResultWriter
NewJSONResultWriter creates a new instance of a JSONResultWriter.
handler.go:62
↓ 1 callers
Method
Start
Start implements Checker.Start. Please refer to Checker.Start for more information.
check.go:218
↓ 1 callers
Function
WithInfoFunc
WithInfoFunc sets functions that compute values to be added to every health check result. It works similarly to WithInfo, but allows dynamic computati
config.go:221
↓ 1 callers
Function
createConfig
(options []HandlerOption)
handler.go:97
↓ 1 callers
Function
createInfoMap
(infoMap map[string]interface{}, infoFuncs []func(map[string]interface{}))
check.go:570
↓ 1 callers
Function
createNextCheckState
(result error, check *Check, state CheckState)
check.go:510
↓ 1 callers
Function
disableResponseCache
(w http.ResponseWriter)
handler.go:83
↓ 1 callers
Function
executeCheckFunc
(ctx context.Context, check *Check)
check.go:478
↓ 1 callers
Function
isCacheExpired
(cacheDuration time.Duration, state *CheckState)
check.go:416
↓ 1 callers
Function
mapHTTPStatusCode
(status AvailabilityStatus, statusCodeUp int, statusCodeDown int)
handler.go:90
↓ 1 callers
Method
mapStateToCheckerResult
()
check.go:394
↓ 1 callers
Function
newChecker
(cfg checkerConfig)
check.go:199
↓ 1 callers
Method
runSynchronousChecks
(ctx context.Context)
check.go:279
↓ 1 callers
Method
startPeriodicChecks
(ctx context.Context)
check.go:315
↓ 1 callers
Function
volatileFunc
()
examples/listeners/main.go:66
↓ 1 callers
Function
volatileFunc
()
examples/showcase/main.go:148
↓ 1 callers
Function
withInterceptors
(interceptors []Interceptor, target InterceptorFunc)
check.go:560
↓ 1 callers
Function
withMiddleware
(interceptors []Middleware, target MiddlewareFunc)
handler.go:115
Method
Check
(ctx context.Context)
handler_test.go:30
Method
GetRunningPeriodicCheckCount
GetRunningPeriodicCheckCount implements Checker.GetRunningPeriodicCheckCount. Please refer to Checker.GetRunningPeriodicCheckCount for more informatio
check.go:253
Method
GetRunningPeriodicCheckCount
()
handler_test.go:34
Method
IsStarted
IsStarted implements Checker.IsStarted. Please refer to Checker.IsStarted for more information.
check.go:260
Method
IsStarted
()
handler_test.go:38
Method
MarshalJSON
MarshalJSON provides a custom marshaller for the CheckResult type.
check.go:155
Method
Start
()
handler_test.go:22
Method
Stop
Stop implements Checker.Stop. Please refer to Checker.Stop for more information.
check.go:240
Method
Stop
()
handler_test.go:26
Function
TestCheckSuccessNotAllChecksExecutedYet
(t *testing.T)
check_test.go:154
Function
TestCheckerAutostartConfig
(t *testing.T)
config_test.go:195
Function
TestCheckerAutostartDisabledConfig
(t *testing.T)
config_test.go:203
Function
TestHandlerIfAuthFailsThenReturnNoDetails
(t *testing.T)
handler_test.go:100
Function
TestHandlerIfCheckFailThenRespondWithNotAvailable
(t *testing.T)
handler_test.go:77
Function
TestHandlerIfCheckSucceedsThenRespondWithAvailable
(t *testing.T)
handler_test.go:89
Function
TestNewCheckerWithDefaults
(t *testing.T)
config_test.go:180
Function
TestNewWithDefaults
(t *testing.T)
config_test.go:165
Function
TestPanicRecovery
(t *testing.T)
check_test.go:158
Function
TestStartStopManualPeriodicChecks
(t *testing.T)
check_test.go:97
Function
TestStatusDownBeforeStatusUnknown
(t *testing.T)
check_test.go:23
Function
TestStatusUnknownBeforeStatusUp
(t *testing.T)
check_test.go:12
Function
TestWhenChecksEmptyThenHandlerResultContainNoChecksMap
(t *testing.T)
handler_test.go:110
Function
TestWhenChecksExecutedThenAggregatedResultUp
(t *testing.T)
check_test.go:146
Function
TestWhenErrorAndAllThresholdsCrossedThenStatusDown
(t *testing.T)
check_test.go:87
Function
TestWhenErrorAndMaxFailuresThresholdNotCrossedThenStatusWarn
(t *testing.T)
check_test.go:67
Function
TestWhenErrorAndMaxTimeInErrorThresholdNotCrossedThenStatusWarn
(t *testing.T)
check_test.go:77
Function
TestWhenErrorThenStatusDown
(t *testing.T)
check_test.go:60
Function
TestWhenNoChecksMadeYetThenStatusUnknown
(t *testing.T)
check_test.go:48
Function
TestWhenNoErrorThenStatusUp
(t *testing.T)
check_test.go:54
Function
TestWhenOneCheckFailedThenAggregatedResultDown
(t *testing.T)
check_test.go:150
Function
TestWithCacheDurationConfig
(t *testing.T)
config_test.go:63
Function
TestWithCheckConfig
(t *testing.T)
config_test.go:30
Function
TestWithChecks
(t *testing.T)
config_test.go:211
Function
TestWithChecksConfig
(t *testing.T)
config_test.go:44
Function
TestWithDisabledCacheConfig
(t *testing.T)
config_test.go:75
Function
TestWithDisabledDetailsConfig
(t *testing.T)
config_test.go:97
Function
TestWithInterceptorConfig
(t *testing.T)
config_test.go:124
Function
TestWithMiddlewareConfig
(t *testing.T)
config_test.go:108
Function
TestWithPeriodicCheckConfig
(t *testing.T)
config_test.go:14
Function
TestWithResultWriterConfig
(t *testing.T)
config_test.go:140
next →
1–100 of 122, ranked by callers