Documentation ¶
Index ¶
- func StartEndpointHealthCheck(ctx context.Context, endpointAddress string, opts ...Option) <-chan bool
- type Option
- func WithClock(clock kclock.WithTicker) Option
- func WithFailureThreshold(threshold int32) Option
- func WithHTTPClient(client *http.Client) Option
- func WithInitialDelay(delay time.Duration) Option
- func WithInterval(interval time.Duration) Option
- func WithRequestTimeout(timeout time.Duration) Option
- func WithSuccessStatusCode(code int) Option
- type RouterOptions
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartEndpointHealthCheck ¶
func StartEndpointHealthCheck(ctx context.Context, endpointAddress string, opts ...Option) <-chan bool
StartEndpointHealthCheck starts a health check on the specified address with the given options. It returns a channel that will emit true if the endpoint is healthy and false if the failure conditions Have been met.
Types ¶
type Option ¶
type Option func(o *healthCheckOptions)
Option is a function that applies a health check option.
func WithClock ¶ added in v1.10.1
func WithClock(clock kclock.WithTicker) Option
WithClock sets a custom clock (for mocking time).
func WithFailureThreshold ¶
WithFailureThreshold sets the failure threshold for the health check.
func WithHTTPClient ¶ added in v1.10.5
WithHTTPClient sets the http.Client to use.
func WithInitialDelay ¶
WithInitialDelay sets the initial delay for the health check.
func WithInterval ¶
WithInterval sets the interval for the health check.
func WithRequestTimeout ¶
WithRequestTimeout sets the request timeout for the health check.
func WithSuccessStatusCode ¶
WithSuccessStatusCode sets the status code for the health check.
type RouterOptions ¶ added in v1.12.0
func NewJSONDataRouterOptions ¶ added in v1.12.0
func NewJSONDataRouterOptions[T any](path string, getter func() (T, error)) RouterOptions
func NewRouterOptions ¶ added in v1.12.0
func NewRouterOptions(path string, handler http.Handler) RouterOptions