Documentation ¶
Overview ¶
Package toolbox is a middleware that provides health check, pprof, profile and statistic services for Macaron.
Index ¶
- func DumpGCSummary(w io.Writer)
- func DumpMemProf(w io.Writer)
- func StartCPUProfile() error
- func StopCPUProfile() error
- func Toolboxer(m *macaron.Macaron, options ...Options) macaron.Handler
- func Version() string
- type HealthCheckFunc
- type HealthCheckFuncDesc
- type HealthChecker
- type Options
- type Statistics
- type Toolbox
- type URLMapInfo
- type UrlMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpGCSummary ¶
DumpGCSummary dumps GC information to io.Writer
Types ¶
type HealthCheckFunc ¶
type HealthCheckFunc func() error
HealthCheckFunc represents a callable function for health check.
type HealthCheckFuncDesc ¶
type HealthCheckFuncDesc struct { Desc string Func HealthCheckFunc }
HealthCheckFunc represents a callable function for health check with description.
type HealthChecker ¶
HealthChecker represents a health check instance.
type Options ¶
type Options struct { // URL prefix for toolbox dashboard. Default is "/debug". URLPrefix string // URL for health check request. Default is "/healthcheck". HealthCheckURL string // Health checkers. HealthCheckers []HealthChecker // Health check functions. HealthCheckFuncs []*HealthCheckFuncDesc // URL for URL map json. Default is "/urlmap.json". URLMapPrefix string // DisableDebug turns off all debug functionality. DisableDebug bool // URL prefix of pprof. Default is "/debug/pprof/". PprofURLPrefix string // URL prefix of profile. Default is "/debug/profile/". ProfileURLPrefix string // Path store profile files. Default is "profile". ProfilePath string }
Options represents a struct for specifying configuration options for the Toolbox middleware.
type Statistics ¶
type Statistics struct { RequestUrl string RequestNum int64 MinTime time.Duration MaxTime time.Duration TotalTime time.Duration }
Statistics struct
type Toolbox ¶
type Toolbox interface { AddHealthCheck(HealthChecker) AddHealthCheckFunc(string, HealthCheckFunc) AddStatistics(string, string, time.Duration) GetMap(io.Writer) JSON(io.Writer) }
Toolbox represents a tool box service for Macaron instance.
type URLMapInfo ¶
type UrlMap ¶
type UrlMap struct { LengthLimit int // limit the urlmap's length if it's equal to 0 there's no limit // contains filtered or unexported fields }
UrlMap contains several statistics struct to log different data
func (*UrlMap) AddStatistics ¶
add statistics task. it needs request method, request url and statistics time duration