2016-01-06 22:24:54 +03:00
|
|
|
package debug
|
|
|
|
|
|
|
|
import (
|
|
|
|
proto "github.com/micro/go-micro/server/debug/proto"
|
|
|
|
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// The debug handler represents an internal server handler
|
|
|
|
// used to determine health, status and env info about
|
|
|
|
// a service node. It's akin to Google's /statusz, /healthz,
|
|
|
|
// and /varz
|
|
|
|
type DebugHandler interface {
|
|
|
|
Health(ctx context.Context, req *proto.HealthRequest, rsp *proto.HealthResponse) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Our own internal handler
|
|
|
|
type debug struct{}
|
|
|
|
|
|
|
|
var (
|
2016-01-07 13:15:30 +03:00
|
|
|
DefaultDebugHandler DebugHandler = new(debug)
|
2016-01-06 22:24:54 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func (d *debug) Health(ctx context.Context, req *proto.HealthRequest, rsp *proto.HealthResponse) error {
|
|
|
|
rsp.Status = "ok"
|
|
|
|
return nil
|
|
|
|
}
|