kratos
kratos copied to clipboard
[Proposal] service health status check
- https://www.amitph.com/custom-health-check-spring-boot-actuator/
https://github.com/grpc/grpc-go/blob/master/health/server.go
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
@shifengbin
here
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) {}
https://github.com/go-kratos/kratos/issues/2479#issuecomment-1305004846
对func的处理简单了点,需要支持如 any 这样类型的返回参数,gomock设计中接口设计较完善,可以参考下。
@tonybase @shenqidebaozi #2541 fix the problem right ? Often the http scope is not covered
@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.
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!