Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom service health check support #242

Closed
bigsky-033 opened this issue Sep 13, 2021 · 8 comments
Closed

Custom service health check support #242

bigsky-033 opened this issue Sep 13, 2021 · 8 comments
Labels
enhancement Auto-generates notes
Milestone

Comments

@bigsky-033
Copy link

I have a question about health check service. Looks like when I launch spring boot application server with LogNet/grpc-spring-boot-starter, health check service is added by GRpcServerRunner.class.

My question is, if I want to add my custom HealthGrpc.HealthImplBase, how can I do that properly? What I tried was registering my custom implementation of HealthGrpc.HealthImplBase as @GRpcService. In this way, it seems that my custom HealthGrpc.HealthImplBase, which I implemented, handles the request when a request is coming to 'grpc.health.v1.Health/Check'. But I'm not sure this is the right way to do that.

So could you please let me know what is the right way to register custom health check service?

@bigsky-033 bigsky-033 changed the title Questions about custom health check service register Question about custom health check service register Sep 13, 2021
@jvmlet jvmlet added this to the 4.5.7 milestone Sep 14, 2021
@jvmlet jvmlet added the enhancement Auto-generates notes label Sep 14, 2021
@jvmlet
Copy link
Collaborator

jvmlet commented Sep 14, 2021

I'll provide configuration to support custom health service registration. What you are doing is fine, just need to disable the default one, I will make it optional.

@bigsky-033
Copy link
Author

Thanks @jvmlet ! Looking forward to see that option.

@jvmlet jvmlet changed the title Question about custom health check service register Custom service health check support Sep 15, 2021
@jvmlet jvmlet closed this as completed in 47cc9f2 Sep 15, 2021
@jvmlet
Copy link
Collaborator

jvmlet commented Sep 15, 2021

@bigsky-033 , with 4.5.7-SNAPSHOT you can register your GRpcHealthStatusManager bean with custom health check service, demo is here

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 16, 2021

You might also be interested in consul health check and registration modes support added in the same PR.
I don't think the default SINGLE-SERVER-GLOBAL-CHECK mode makes sense if you are using consul with custom health check. I'll update readme soon, but you can see the code and control the consul registration mode with grpc.consul.registration-mode property

@bigsky-033
Copy link
Author

Thanks @jvmlet for the information and I think just seeing code is enough for me. Thanks for your kindness.

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 20, 2021

@bigsky-033, I had to redesign the custom health check support a bit to make it @GRpcService compatible (support security, custom interceptors, metrics ect ). Please inherit you implementation from ManagedHealthStatusService and register with @GRpcService annotation, see updated demo

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 20, 2021

4.5.7 released

@bigsky-033
Copy link
Author

Thanks @jvmlet !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement Auto-generates notes
Projects
None yet
Development

No branches or pull requests

2 participants