kratos icon indicating copy to clipboard operation
kratos copied to clipboard

[Question] Why does grpc server not open the configuration of health Serveroption?

Open pinguo-lixin opened this issue 3 years ago • 4 comments

我们期望在 GRPC Server 的健康检查中实现一些自定义的逻辑,用以更加可靠地实现 health, ready 探测,但发现没有提供相应的 ServerOption,以致无法注入自定义的逻辑。

请问:出于什么考虑,没有通过 ServerOption 开放对 health 的配置?

https://github.com/go-kratos/kratos/blob/main/transport/grpc/server.go#L118

pinguo-lixin avatar Aug 31 '21 02:08 pinguo-lixin

目前是实现了官方默认的 health server,自定义需要装配进来才可以,直接注册重复的 server 不知道是否可以。

实现自定义的 health proto,或者通过 HTTP health 接口也可以。

tonybase avatar Aug 31 '21 04:08 tonybase

目前是实现了官方默认的 health server,自定义需要装配进来才可以,直接注册重复的 server 不知道是否可以。

实现自定义的 health proto,或者通过 HTTP health 接口也可以。

你说的注册重复的server,是指gRPC的service吧?重复注册相同的service是不行的,需要自己实现一个然后装配进去

letian0805 avatar Sep 06 '21 03:09 letian0805

@tonybase 那么是否可以增加对health的option操作?

yuchen-sun avatar Oct 19 '21 12:10 yuchen-sun

这个Issue还会更新吗?试了一下自定义的health proto 不能用grpc_health_probe来healthcheck

https://github.com/grpc-ecosystem/grpc-health-probe

herealways avatar Dec 15 '21 10:12 herealways