Documentation ¶
Overview ¶
Package toolbox healthcheck
type DatabaseCheck struct { }
func (dc *DatabaseCheck) Check() error { if dc.isConnected() { return nil } else { return errors.New("can't connect database") } }
AddHealthCheck("database",&DatabaseCheck{})
more docs: http://beego.me/docs/module/toolbox.md
Index ¶
- Variables
- func AddHealthCheck(name string, hc HealthChecker)
- func GetCPUProfile(w io.Writer)
- func GetYearDays(year int) int
- func GetYearMonthDays(year int, month int) int
- func MemProf(w io.Writer)
- func PrintGCSummary(w io.Writer)
- func ProcessInput(input string, w io.Writer)
- type HealthChecker
- type Statistics
- type URLMap
Constants ¶
This section is empty.
Variables ¶
var AdminCheckList map[string]HealthChecker
AdminCheckList holds health checker map
Functions ¶
func AddHealthCheck ¶
func AddHealthCheck(name string, hc HealthChecker)
AddHealthCheck add health checker with name string
func GetYearMonthDays ¶
GetYearMonthDays 获取指定年、月份的总天数
func PrintGCSummary ¶
PrintGCSummary print gc information to io.Writer
func ProcessInput ¶
ProcessInput parse input command string
Types ¶
type HealthChecker ¶
type HealthChecker interface {
Check() error
}
HealthChecker health checker interface
type Statistics ¶
type Statistics struct { RequestURL string RequestController string RequestNum int64 MinTime time.Duration MaxTime time.Duration TotalTime time.Duration }
Statistics struct
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
var StatisticsMap *URLMap
StatisticsMap hosld global statistics data map
func (*URLMap) AddStatistics ¶
func (m *URLMap) AddStatistics(requestMethod, requestURL, requestController string, requesttime time.Duration)
AddStatistics add statistics task. it needs request method, request url, request controller and statistics time duration
func (*URLMap) GetMapData ¶
GetMapData return all mapdata