beego: github.com/astaxie/beego/core/governor Index | Files

package governor

import "github.com/astaxie/beego/core/governor"

Package governor 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

Package Files

command.go healthcheck.go profile.go

Variables

var AdminCheckList map[string]HealthChecker

AdminCheckList holds health checker map

var CommandNotFound = errors.New("Command not found")

func AddHealthCheck Uses

func AddHealthCheck(name string, hc HealthChecker)

AddHealthCheck add health checker with name string

func GetCPUProfile Uses

func GetCPUProfile(w io.Writer)

GetCPUProfile start cpu profile monitor

func MemProf Uses

func MemProf(w io.Writer)

MemProf record memory profile in pprof

func PrintGCSummary Uses

func PrintGCSummary(w io.Writer)

PrintGCSummary print gc information to io.Writer

func ProcessInput Uses

func ProcessInput(input string, w io.Writer)

ProcessInput parse input command string

func RegisterCommand Uses

func RegisterCommand(module string, commandName string, command Command)

RegisterCommand is not thread-safe do not use it in concurrent case

type Command Uses

type Command interface {
    Execute(params ...interface{}) *Result
}

Command is an experimental interface We try to use this to decouple modules All other modules depends on this, and they register the command they support We may change the API in the future, so be careful about this.

func GetCommand Uses

func GetCommand(module string, cmdName string) Command

type HealthChecker Uses

type HealthChecker interface {
    Check() error
}

HealthChecker health checker interface

type Result Uses

type Result struct {
    // Status is the same as http.Status
    Status  int
    Error   error
    Content interface{}
}

func (*Result) IsSuccess Uses

func (r *Result) IsSuccess() bool

Package governor imports 12 packages (graph) and is imported by 4 packages. Updated 2020-11-07. Refresh now. Tools for package owners.