Skip to content

Support channel level application health check options#2964

Merged
Huixxi merged 4 commits intoapache:masterfrom
zhoukangsheng:support_health_check_option
May 18, 2025
Merged

Support channel level application health check options#2964
Huixxi merged 4 commits intoapache:masterfrom
zhoukangsheng:support_health_check_option

Conversation

@zhoukangsheng
Copy link
Copy Markdown
Contributor

@zhoukangsheng zhoukangsheng commented May 7, 2025

What problem does this PR solve?

Current Application-Layer Health Check Mechanism
The current application-layer health check mechanism is configured via the -health_check_path flag. If this flag is left empty, the health check is disabled. However, since gflag is a global variable, once set, it enables the application-layer health check for all downstream services accessed by the service.

For complex services that may interact with dozens or even hundreds of downstream services (some of which might not be brpc-based and could instead be Go/Java services), not all downstream services necessarily support health check requests. Even for those that do, the health check request paths (URLs) may vary across services. Therefore, it is necessary to support channel-level configuration for application-layer health check parameters.

Issue Number:

Problem Summary:

What is changed and the side effects?

no

Changed:
About This PR
This PR maintains backward compatibility with the existing gflag-based configuration for health check paths and timeouts while introducing support for setting health check parameters via members of ChannelOptions (hc_option). Parameters in ChannelOptions (hc_option) take precedence over the global gflag settings. If a parameter is not specified in ChannelOptions, the corresponding gflag value will be used as the fallback.

Side effects:

  • Performance effects: no
  • Breaking backward compatibility: no

Check List:

@zhoukangsheng zhoukangsheng reopened this May 7, 2025
@wwbmmm wwbmmm changed the title 支持channel粒度设置应用层健康检查参数 Support channel level application health check options May 8, 2025
@zhoukangsheng zhoukangsheng force-pushed the support_health_check_option branch from 4eb3e42 to 5496691 Compare May 8, 2025 02:53
Comment thread src/brpc/details/naming_service_thread.h Outdated
Comment thread src/brpc/channel.h Outdated
Comment thread src/brpc/socket.h Outdated
Comment thread src/brpc/socket_map.h Outdated
Comment thread src/brpc/channel.cpp
@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented May 8, 2025

Thank you for contributing! This is a useful feature.
I have modified the title to English. Since this is an Apache project and we'd better using Engish in PR discussions.

@zhoukangsheng zhoukangsheng force-pushed the support_health_check_option branch from eb3cc66 to bf47002 Compare May 9, 2025 14:52
@zhoukangsheng
Copy link
Copy Markdown
Contributor Author

Thank you for contributing! This is a useful feature.
I have modified the title to English. Since this is an Apache project and we'd better using Engish in PR discussions.

Thank you for your code review very much. I have modified it according to your suggestion. Please check if there is anything else that needs to be modified.

@zhoukangsheng zhoukangsheng force-pushed the support_health_check_option branch from bf47002 to 84071ed Compare May 10, 2025 06:40
Comment thread src/brpc/channel.h Outdated
Comment thread src/brpc/socket.h Outdated
Comment thread src/brpc/details/health_check.cpp Outdated
@zhoukangsheng
Copy link
Copy Markdown
Contributor Author

ut
The implementation of this UT appears to fail randomly. Increasing the number of executions of SelectServer can, to some extent, make the probability of IP selection closer to the proportion of the set weight to the total weight.

@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented May 10, 2025

LGTM

@Huixxi Huixxi merged commit 1c03278 into apache:master May 18, 2025
15 checks passed
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.

3 participants