debugstatus

package
v0.0.0-...-0fedc61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2015 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

type Pinger

type Pinger interface {
	Ping() error
}

Pinger is an interface that wraps the Ping method. It is implemented by mgo.Session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL