Documentation ¶
Overview ¶
Package health check provides to add echo instance. Example: ``` package main import (
"github.com/labstack/echo/v4" "github.com/labstack/echo-contrib/healthcheck"
)
func main() { e := echo.New() opts:=[]healthcheck.Option{ healthcheck.WithTimeout(5*time.Second), healthcheck.WithChecker("call",healthcheck.HttpChecker("https://www.google.com",200,0,nil)), healthcheck.WithObserver("call",healthcheck.TcpChecker("127.0.0.1",5*time.Second)), healthcheck.WithObserver("fileX",healthcheck.FileChecker("abc")), } h:=healthcheck.New(opts...).SetEndpoint("status") h.Use(e) e.Logger.Fatal(e.Start(":1323")) }
``` Check the status: ``` curl -X GET http://localhost:5000/status ```
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMaxCheckTimeExceededError = errors.New("max check time exceeded")
)
Functions ¶
This section is empty.
Types ¶
type Checker ¶
func CheckMongoDb ¶
type CheckerFunc ¶
func FileChecker ¶
func FileChecker(f string) CheckerFunc
func HttpChecker ¶
func TcpChecker ¶
func TcpChecker(addr string, timeout time.Duration) CheckerFunc
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
func (*Health) SetEndpoint ¶
Click to show internal directories.
Click to hide internal directories.