Documentation
¶
Overview ¶
debugstatus contains the removed contents of the deprecated github.com/juju/juju/utils/v2/debugstatus package. See https://github.com/juju/utils/pull/320/files .
debugstatus contains the removed contents of the deprecated github.com/juju/juju/utils/v2/debugstatus package. See https://github.com/juju/utils/pull/320/files .
Index ¶
- Variables
- func Check(ctx context.Context, checkers ...CheckerFunc) map[string]CheckResult
- type CheckResult
- type CheckerFunc
- type Collector
- type DebugEventsRequest
- type DebugInfoRequest
- type DebugPprofEndpointsRequest
- type DebugPprofRequest
- type DebugRequestsRequest
- type DebugStatusRequest
- type Handler
- func (h *Handler) DebugEvents(p httprequest.Params, r *DebugEventsRequest) error
- func (h *Handler) DebugInfo(*DebugInfoRequest) (Version, error)
- func (h *Handler) DebugPprof(p httprequest.Params, _ *DebugPprofRequest) error
- func (h *Handler) DebugPprofEndpoints(p httprequest.Params, r *DebugPprofEndpointsRequest) error
- func (h *Handler) DebugRequests(p httprequest.Params, r *DebugRequestsRequest) error
- func (h *Handler) DebugStatus(p httprequest.Params, _ *DebugStatusRequest) (map[string]CheckResult, error)
- type Version
Constants ¶
This section is empty.
Variables ¶
var ErrNoPprofConfigured = errgo.New("no pprof access configured")
ErrNoPprofConfigured is the error returned on access to endpoints when Handler.CheckPprofAllowed is nil.
var ErrNoTraceConfigured = errgo.New("no trace access configured")
ErrNoTraceConfigured is the error returned on access to endpoints when Handler.CheckTraceAllowed is nil.
var StartTime = time.Now().UTC()
StartTime holds the time that the code started running.
Functions ¶
func Check ¶
func Check(ctx context.Context, 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(context.Context) (key string, result CheckResult)
ServerStartTime reports the time when the application was started.
type CheckerFunc ¶
type CheckerFunc func(ctx context.Context) (key string, result CheckResult)
CheckerFunc represents a function returning the check machine friendly key and the result.
func MongoCollections ¶
func MongoCollections(c Collector) CheckerFunc
MongoCollections returns a status checker checking that all the expected Mongo collections are present in the database.
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 DebugEventsRequest ¶
type DebugEventsRequest struct {
httprequest.Route `httprequest:"GET /debug/events"`
}
DebugEventsRequest describes the /debug/events endpoint.
type DebugInfoRequest ¶
type DebugInfoRequest struct {
httprequest.Route `httprequest:"GET /debug/info"`
}
DebugInfoRequest describes the /debug/info endpoint.
type DebugPprofEndpointsRequest ¶
type DebugPprofEndpointsRequest struct {
httprequest.Route `httprequest:"GET /debug/pprof/:name"`
Name string `httprequest:"name,path"`
}
DebugPprofEndpointsRequest describes the endpoints under /debug/prof.
type DebugPprofRequest ¶
type DebugPprofRequest struct {
httprequest.Route `httprequest:"GET /debug/pprof/"`
}
DebugPprofRequest describes the /debug/pprof/ endpoint.
type DebugRequestsRequest ¶
type DebugRequestsRequest struct {
httprequest.Route `httprequest:"GET /debug/requests"`
}
DebugRequestsRequest describes the /debug/requests endpoint.
type DebugStatusRequest ¶
type DebugStatusRequest struct {
httprequest.Route `httprequest:"GET /debug/status"`
}
DebugStatusRequest describes the /debug/status endpoint.
type Handler ¶
type Handler struct {
// Check will be called to obtain the current health of the
// system. It should return a map as returned from the
// Check function. If this is nil, an empty result will
// always be returned from /debug/status.
Check func(context.Context) map[string]CheckResult
// Version should hold the current version
// of the binary running the server, served
// from the /debug/info endpoint.
Version Version
// CheckPprofAllowed will be used to check whether the
// given pprof request should be allowed.
// It should return an error if not, which will not be masked.
// If this is nil, no access will be allowed to any
// of the endpoints under /debug/pprof - the
// error returned will be ErrNoPprofConfigured.
CheckPprofAllowed func(req *http.Request) error
// CheckTraceAllowed will be used to check whether the given
// trace request should be allowed. It should return an error if
// not, which will not be masked. If this is nil, no access will
// be allowed to either /debug/events or /debug/requests - the
// error returned will be ErrNoTraceConfigured. If access is
// allowed, the sensitive value specifies whether sensitive trace
// events will be shown.
CheckTraceAllowed func(req *http.Request) (sensitive bool, err error)
}
Handler implements a type that can be used with httprequest.Handlers to serve a standard set of /debug endpoints, including the version of the system, its current health status the runtime profiling information.
func (*Handler) DebugEvents ¶
func (h *Handler) DebugEvents(p httprequest.Params, r *DebugEventsRequest) error
DebugEvents serves the /debug/events endpoint.
func (*Handler) DebugInfo ¶
func (h *Handler) DebugInfo(*DebugInfoRequest) (Version, error)
DebugInfo returns version information on the current server.
func (*Handler) DebugPprof ¶
func (h *Handler) DebugPprof(p httprequest.Params, _ *DebugPprofRequest) error
DebugPprof serves index information on the available pprof endpoints.
func (*Handler) DebugPprofEndpoints ¶
func (h *Handler) DebugPprofEndpoints(p httprequest.Params, r *DebugPprofEndpointsRequest) error
DebugPprofEndpoints serves all the endpoints under DebugPprof.
func (*Handler) DebugRequests ¶
func (h *Handler) DebugRequests(p httprequest.Params, r *DebugRequestsRequest) error
DebugRequests serves the /debug/requests endpoint.
func (*Handler) DebugStatus ¶
func (h *Handler) DebugStatus(p httprequest.Params, _ *DebugStatusRequest) (map[string]CheckResult, error)
DebugStatus returns the current status of the server.