Skip to content

Instantly share code, notes, and snippets.

@eranharel
Created August 5, 2019 13:24
Show Gist options
  • Save eranharel/87cc9ea075efb1cfec37e0bdd74ed8e1 to your computer and use it in GitHub Desktop.
Save eranharel/87cc9ea075efb1cfec37e0bdd74ed8e1 to your computer and use it in GitHub Desktop.
go-sundheit regiester built-in DNS check
import (
"time"
health "github.com/AppsFlyer/go-sundheit"
"github.com/AppsFlyer/go-sundheit/checks"
)
func registerHealthChecks() {
// create a new health instance
var h = health.New()
// Schedule a host resolution check for `example.com`, requiring at least one results, and running every 10 sec
h.RegisterCheck(&health.Config{
Check: checks.NewResolveCheck("example.com", 200*time.Millisecond, 1),
ExecutionPeriod: 10 * time.Second,
})
// schedule more checks...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment