Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var StartTime = time.Now().UTC()
StartTime holds the time that the code started running.
Functions ¶
func Check ¶
func Check(checkers ...CheckerFunc) map[string]CheckResult
Check collects the status check results from the given checkers.
Types ¶
type CheckResult ¶
type CheckResult struct { // Name is the human readable name for the check. Name string // Value is the check result. Value string // Passed reports whether the check passed. Passed bool // Duration holds the duration that the // status check took to run. Duration time.Duration }
CheckResult holds the result of a single status check.
func ServerStartTime ¶
func ServerStartTime() (key string, result CheckResult)
ServerStartTime reports the time when the application was started.
type CheckerFunc ¶
type CheckerFunc func() (key string, result CheckResult)
CheckerFunc represents a function returning the check machine friendly key and the result.
func Connection ¶
func Connection(p Pinger) CheckerFunc
Connection returns a status checker reporting whether the given Pinger is connected.
func MongoCollections ¶
func MongoCollections(c Collector) CheckerFunc
MongoCollections returns a status checker checking that all the expected Mongo collections are present in the database.
func Rename ¶
func Rename(newKey, newName string, check CheckerFunc) CheckerFunc
Rename changes the key and/or result name returned by the given check. It is possible to pass an empty string to avoid changing one of the values. This means that if both key are name are empty, this closure is a no-op.
type Collector ¶
type Collector interface { // Collections returns the Mongo collections that we expect to exist in // the Mongo database. Collections() []*mgo.Collection // CollectionNames returns the names of the collections actually present in // the Mongo database. CollectionNames() ([]string, error) }
Collector is an interface that groups the methods used to check that a Mongo database has the expected collections. It is usually implemented by types extending mgo.Database to add the Collections() method.