kratos icon indicating copy to clipboard operation
kratos copied to clipboard

[Proposal] service health status check

Open shenqidebaozi opened this issue 2 years ago • 8 comments

  • https://www.amitph.com/custom-health-check-spring-boot-actuator/

shenqidebaozi avatar Oct 28 '22 03:10 shenqidebaozi

https://github.com/grpc/grpc-go/blob/master/health/server.go

daemon365 avatar Oct 28 '22 03:10 daemon365

enum Status {
   UP,
   DOWN
}
message HealthRequest {
    string service = 1;
}
message HealthReply {
  Status status = 1;
}
service Health {
    rpc HealthCheck (HealthRequest) returns (HealthReply)  {
      option (google.api.http) = {
        get: "/health",
      };
  }
}

HTTP/gRPC -> Health[ Status: Up/Down ] -> Component[ ping: redis/mysql ]

/health?service=xxx

tonybase avatar Oct 28 '22 12:10 tonybase

@shifengbin

daemon365 avatar Oct 29 '22 07:10 daemon365

here

shifengbin avatar Oct 29 '22 07:10 shifengbin

type Checker interface {
	Check(ctx context.Context) error
}
type CheckerFunc func() error
func (f CheckerFunc) Check(ctx context.Context) error {
	return f()
}

type Health struct {}
func (h *Health) Check(ctx context.Context) error {}
func (h *Health) Start(ctx context.Context) error {}
func (h *Health) Stop(ctx context.Context) error {}
func (h *Health) SetStatus(service string, status Status) {}
func (h *Health) ServeHTTP(w http.ResponseWriter, r *http.Request) {}

tonybase avatar Nov 07 '22 02:11 tonybase

https://github.com/go-kratos/kratos/issues/2479#issuecomment-1305004846

对func的处理简单了点,需要支持如 any 这样类型的返回参数,gomock设计中接口设计较完善,可以参考下。

Darrenzzy avatar Nov 11 '22 00:11 Darrenzzy

@tonybase @shenqidebaozi #2541 fix the problem right ? Often the http scope is not covered

perriea avatar Nov 29 '22 10:11 perriea

@tonybase @shenqidebaozi #2541 fix the problem right ? Often the http scope is not covered

@perriea this issue is the design of the planned kratos health check interface, which has no direct relationship with your modification.

shenqidebaozi avatar Nov 30 '22 07:11 shenqidebaozi

Hi, @shenqidebaozi! I'm Dosu, and I'm here to help the kratos team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, the issue is about implementing a service health status check using Spring Boot Actuator. There have been some helpful comments with links and code snippets for customizing the health check. Additionally, there has been a discussion about the design of the planned Kratos health check interface.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the kratos repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your contribution!

dosubot[bot] avatar Nov 03 '23 16:11 dosubot[bot]