Documentation ¶
Index ¶
- Variables
- func RedisCheck(url string) func() error
- type Check
- func Async(check Check, interval time.Duration) Check
- func AsyncWithContext(ctx context.Context, check Check, interval time.Duration) Check
- func DNSResolveCheck(host string, timeout time.Duration) Check
- func DatabasePingCheck(database *sql.DB, timeout time.Duration) Check
- func GoroutineCountCheck(threshold int) Check
- func HTTPGetCheck(url string, timeout time.Duration) Check
- func PostgresCheck(dbUrl string) Check
- func TCPDialCheck(addr string, timeout time.Duration) Check
- func Timeout(check Check, timeout time.Duration) Check
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errors.New("no data yet")
ErrNoData is returned if the first call of an Async() wrapped Check has not yet returned.
Functions ¶
func RedisCheck ¶
checks: - connection (Pool) - closeTest connection - ping
Types ¶
type Check ¶
type Check func() error
func Async ¶
Async converts a Check into an asynchronous check that runs in a background goroutine at a fixed interval. The check is called at a fixed rate, not with a fixed delay between invocations. If your check takes longer than the interval to execute, the next execution will happen immediately.
Note: if you need to clean up the background goroutine, use AsyncWithContext().
func AsyncWithContext ¶
AsyncWithContext converts a Check into an asynchronous check that runs in a background goroutine at a fixed interval. The check is called at a fixed rate, not with a fixed delay between invocations. If your check takes longer than the interval to execute, the next execution will happen immediately.
Note: if you don't need to cancel execution (because this runs forever), use Async()
func DNSResolveCheck ¶
DNSResolveCheck returns a Check that makes sure the provided host can resolve to at least one IP address within the specified timeout.
func DatabasePingCheck ¶
DatabasePingCheck returns a Check that validates connectivity to a database/sql.DB using Ping().
func GoroutineCountCheck ¶
GoroutineCountCheck returns a Check that fails if too many goroutines are running (which could indicate a resource leak).
func HTTPGetCheck ¶
HTTPGetCheck returns a Check that performs an HTTP GET request against the specified URL. The check fails if the response times out or returns a non-200 status code.
func PostgresCheck ¶
checks : - connection - close - ping - select
func TCPDialCheck ¶
TCPDialCheck returns a Check that checks TCP connectivity to the provided endpoint.