Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

support grpc health check #2493

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

jiangyt-git
Copy link
Contributor

What problem does this PR solve?

支持grpc的健康检查协议
Issue Number:

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@jiangyt-git jiangyt-git force-pushed the feature/support_grpc_health_check branch from b9a8322 to b5c97b2 Compare January 4, 2024 11:26
@chenBright
Copy link
Contributor

HealthService好像已经支持了吧。
https://github.com/apache/brpc/blob/master/src/brpc/builtin/health_service.cpp

@jiangyt-git
Copy link
Contributor Author

HealthService好像已经支持了吧。 https://github.com/apache/brpc/blob/master/src/brpc/builtin/health_service.cpp

支持的grpc 官方定义的健康检查协议,response是这样的:
message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
SERVICE_UNKNOWN = 3; // Used only by the Watch method.
}
optional ServingStatus status = 1;
}

@jiangyt-git
Copy link
Contributor Author

HealthService好像已经支持了吧。 https://github.com/apache/brpc/blob/master/src/brpc/builtin/health_service.cpp

支持的grpc 官方定义的健康检查协议,response是这样的: message HealthCheckResponse { enum ServingStatus { UNKNOWN = 0; SERVING = 1; NOT_SERVING = 2; SERVICE_UNKNOWN = 3; // Used only by the Watch method. } optional ServingStatus status = 1; }

请求对应的path是: /grpc.health.v1.Health/Check

@chenBright
Copy link
Contributor

health_reporter满足不了grpc健康检查的要求吧,获取不了HealthCheckRequest和设置不了HealthCheckResponse。

@jiangyt-git
Copy link
Contributor Author

health_reporter满足不了grpc健康检查的要求吧,获取不了HealthCheckRequest和设置不了HealthCheckResponse。

grpc和http 都是写的 cntl->response_attachment(),理论上是可以定制的。

@chenBright
Copy link
Contributor

可以补充一下UT吗

@jiangyt-git
Copy link
Contributor Author

可以补充一下UT吗

好的,我补一下。

@jiangyt-git jiangyt-git force-pushed the feature/support_grpc_health_check branch from ed56726 to ec082be Compare January 5, 2024 11:24
@jiangyt-git jiangyt-git force-pushed the feature/support_grpc_health_check branch from ec082be to de5ce5c Compare January 5, 2024 11:33
@jiangyt-git
Copy link
Contributor Author

可以补充一下UT吗
已经加好了

@jiangyt-git jiangyt-git force-pushed the feature/support_grpc_health_check branch 3 times, most recently from 9c9d739 to 2dfd003 Compare January 9, 2024 09:38
src/brpc/server.cpp Outdated Show resolved Hide resolved
@jiangyt-git jiangyt-git force-pushed the feature/support_grpc_health_check branch from 2dfd003 to de5ce5c Compare January 10, 2024 08:23
@chenBright
Copy link
Contributor

LGTM

1 similar comment
@wwbmmm
Copy link
Contributor

wwbmmm commented Jan 17, 2024

LGTM

@wwbmmm wwbmmm merged commit ff75449 into apache:master Jan 23, 2024
36 checks passed
jiangdongzi pushed a commit to jiangdongzi/brpc that referenced this pull request Jan 31, 2024
* support grpc health check protocol

* add grpc health check ut

---------

Co-authored-by: jiangyuting <jiangyutingwangyi@163.com>
@wasphin wasphin mentioned this pull request Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants