feat(probe): add Kubernetes probe support with liveness, readiness, and startup checks#3213
Open
Alanxtl wants to merge 4 commits intoapache:developfrom
Open
feat(probe): add Kubernetes probe support with liveness, readiness, and startup checks#3213Alanxtl wants to merge 4 commits intoapache:developfrom
Alanxtl wants to merge 4 commits intoapache:developfrom
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3213 +/- ##
===========================================
+ Coverage 46.76% 47.93% +1.17%
===========================================
Files 295 467 +172
Lines 17172 33943 +16771
===========================================
+ Hits 8031 16272 +8241
- Misses 8287 16355 +8068
- Partials 854 1316 +462 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This is the implemention of #2039
which is the rewritten of #3047
usage are demonstrated in apache/dubbo-go-samples#1033
docs are written in apache/dubbo-website#3193
Kubernetes 探针(Probe)功能说明
本模块提供独立的 HTTP 探针服务,面向 Kubernetes 的
liveness、readiness、startup三类探针。它支持用户自定义健康检查逻辑,并可选择性地与 Dubbo Server 生命周期进行内部状态对齐。
设计目标
liveness默认不带内部逻辑,避免不当重启。readiness/startup可选用内部状态。默认 HTTP 路径
当启用 probe 后,默认在22222端口下暴露以下路径:
GET /live:liveness 探针GET /ready:readiness 探针GET /startup:startup 探针响应规则:
200503new api 配置方式
通过
metrics.NewOptions(...)传入以下 Option 配置:old api 配置方式
在
metrics配置下新增probe子配置:配置项说明:
enabled:是否开启 probe 服务port:probe HTTP 端口liveness-path:liveness 路径readiness-path:readiness 路径startup-path:startup 路径use-internal-state:是否启用内部生命周期状态检查,默认启用内部状态(UseInternalState)
当
use-internal-state: true时,探针会附加内部状态检查:readiness依赖probe.SetReady(true/false)startup依赖probe.SetStartupComplete(true/false)默认行为:
Server.Serve()成功执行)会设置ready=true、startup=trueready=false如果设置为
false,则完全由用户注册的回调决定探针结果。自定义健康检查(推荐)
通过注册回调即可扩展探针逻辑:
注意事项
Kubernetes 示例
Description
Fixes # (issue)
Checklist
develop