Documentation
¶
Index ¶
- func AllocsHandler() echo.HandlerFunc
- func BlockHandler() echo.HandlerFunc
- func CmdlineHandler() echo.HandlerFunc
- func GoroutineHandler() echo.HandlerFunc
- func HeapHandler() echo.HandlerFunc
- func IndexHandler() echo.HandlerFunc
- func MutexHandler() echo.HandlerFunc
- func ProfileHandler() echo.HandlerFunc
- func SymbolHandler() echo.HandlerFunc
- func ThreadCreateHandler() echo.HandlerFunc
- func TraceHandler() echo.HandlerFunc
- type Checker
- type Closer
- type DebugServer
- func (d *DebugServer) AddChecker(checker Checker)
- func (d *DebugServer) AddCheckers(checkers []Checker)
- func (d *DebugServer) Live(c echo.Context) error
- func (d *DebugServer) Ready(c echo.Context) error
- func (d *DebugServer) RunDebug() error
- func (d *DebugServer) SetReady(ready bool)
- func (d *DebugServer) ShutdownDebug(ctx context.Context) error
- type DefaultChecker
- type DefaultCloser
- type Server
- type ServerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocsHandler ¶ added in v0.0.3
func AllocsHandler() echo.HandlerFunc
AllocsHandler will pass the call from /debug/pprof/allocs to pprof.
func BlockHandler ¶ added in v0.0.3
func BlockHandler() echo.HandlerFunc
BlockHandler will pass the call from /debug/pprof/block to pprof.
func CmdlineHandler ¶ added in v0.0.3
func CmdlineHandler() echo.HandlerFunc
CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof.
func GoroutineHandler ¶ added in v0.0.3
func GoroutineHandler() echo.HandlerFunc
GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof.
func HeapHandler ¶ added in v0.0.3
func HeapHandler() echo.HandlerFunc
HeapHandler will pass the call from /debug/pprof/heap to pprof.
func IndexHandler ¶ added in v0.0.3
func IndexHandler() echo.HandlerFunc
IndexHandler will pass the call from /debug/pprof to pprof.
func MutexHandler ¶ added in v0.0.3
func MutexHandler() echo.HandlerFunc
MutexHandler will pass the call from /debug/pprof/mutex to pprof.
func ProfileHandler ¶ added in v0.0.3
func ProfileHandler() echo.HandlerFunc
ProfileHandler will pass the call from /debug/pprof/profile to pprof.
func SymbolHandler ¶ added in v0.0.3
func SymbolHandler() echo.HandlerFunc
SymbolHandler will pass the call from /debug/pprof/symbol to pprof.
func ThreadCreateHandler ¶ added in v0.0.3
func ThreadCreateHandler() echo.HandlerFunc
ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof.
func TraceHandler ¶ added in v0.0.3
func TraceHandler() echo.HandlerFunc
TraceHandler will pass the call from /debug/pprof/trace to pprof.
Types ¶
type DebugServer ¶
type DebugServer struct {
PORT string `json:"port" envconfig:"PORT" default:":8084"`
// contains filtered or unexported fields
}
func NewDebugServer ¶
func NewDebugServer(port string) *DebugServer
func (*DebugServer) AddChecker ¶
func (d *DebugServer) AddChecker(checker Checker)
func (*DebugServer) AddCheckers ¶
func (d *DebugServer) AddCheckers(checkers []Checker)
AddCheckers for check your server is live
func (*DebugServer) Ready ¶
func (d *DebugServer) Ready(c echo.Context) error
Ready is probe checker
func (*DebugServer) RunDebug ¶
func (d *DebugServer) RunDebug() error
func (*DebugServer) SetReady ¶
func (d *DebugServer) SetReady(ready bool)
SetReady set server ready
warning use this method only when you sure that server is ready
func (*DebugServer) ShutdownDebug ¶
func (d *DebugServer) ShutdownDebug(ctx context.Context) error
type DefaultChecker ¶
DefaultChecker is a default implementation of Checker if you want simple checker without implementation Checker interface tou can call this function and receive Checker interface
func NewDefaultChecker ¶
func NewDefaultChecker(name string, checkFunc func() error) *DefaultChecker
func (*DefaultChecker) Check ¶
func (c *DefaultChecker) Check() error
func (*DefaultChecker) Name ¶
func (c *DefaultChecker) Name() string
type DefaultCloser ¶
type DefaultCloser struct {
Name string `json:"name"`
CloseFunc func(ctx context.Context, wg *sync.WaitGroup) error `json:"close"`
}
DefaultCloser is a default implementation of Closer if you want simple checker without implementation Closer interface tou can call this function and receive Closer interface
func (*DefaultCloser) GetName ¶
func (d *DefaultCloser) GetName() string
type Server ¶
type Server struct {
*DebugServer
// contains filtered or unexported fields
}
Server is app engine with debug server
Use AddCloser to add closer objects for shutdown your application gracefully(for more information see AddCloser)
Use AddActor to add actor control you background task(for more information see AddActor)
Use AddChecker to add checker for live probe(for more information see AddChecker)
You can change config engine use ENV variables DEBUG_PORT and SHUTDOWN_TIMEOUT(for example 30s)
func NewServer ¶
NewServer create new server
You can change config engine use ENV variables DEBUG_PORT and SHUTDOWN_TIMEOUT(for example 30s) or use With function
func (*Server) AddActor ¶
AddActor add actor control you background task you have execute function and done function(interrupt function) interrupt function handle the error execute function is called when server is ready
func (*Server) AddCloser ¶
AddCloser add closer object for shutdown your application gracefully you need to handle the context and call wg.Done() when done
func (*Server) AddClosers ¶
type ServerOpt ¶
type ServerOpt func(*Server)
func WithDebugPort ¶
WithDebugPort set debug port use value with `:` for example: :8084
func WithDisableBanner ¶
func WithDisableBanner() ServerOpt
WithDisableBanner disable witcher Banner
func WithShutdownTimeout ¶
WithShutdownTimeout set shutdown timeout
timeout is duration for graceful shutdown