-
Notifications
You must be signed in to change notification settings - Fork 527
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
feat: 🎸 支持多版本能力:根据不同路由映射不同的Version
版本。
#1429
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1429 +/- ##
==========================================
+ Coverage 35.91% 43.53% +7.62%
==========================================
Files 69 76 +7
Lines 11576 12320 +744
==========================================
+ Hits 4157 5364 +1207
+ Misses 7104 6621 -483
- Partials 315 335 +20 |
ctx.SetContext(config.XPreHigressTag, "") | ||
ctx.SetContext(grayConfig.BackendGrayTag, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方的逻辑是不是有问题,如果versionPredicates一个都没匹配上呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方的逻辑是不是有问题,如果versionPredicates一个都没匹配上呢?
这个context 用于设置cookie哈,如果设置多版本,除了设置了skippedPathPrefixes
以及skippedByHeaders
之外,所有请求都会经过插件处理。不过这段代码优化下,不需要设置为 空字符串,但是需要在使用的时候判断下,否则会报panic异常。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 XPreHigressTag 的意思是说上一次请求所命中的版本吗?BackendGrayTag 只是给后端应用或者中间监控组件用来标识命中了哪个版本的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 XPreHigressTag 的意思是说上一次请求所命中的版本吗?BackendGrayTag 只是给后端应用或者中间监控组件用来标识命中了哪个版本的?
是的,如果不是多版本,这两个都会记录在Cookie中。多版本就不依赖cookie了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多版本不依赖Cookie的原因是靠path匹配可以稳定的确定目标版本,所以不用知道前一次是命中了哪个版本?
如果是的话,那要是命中的路由没有匹配到多版本的path prefix呢,也就是说多版本的path prefix没有覆盖所有的请求场景?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多版本不依赖Cookie的原因是靠path匹配可以稳定的确定目标版本,所以不用知道前一次是命中了哪个版本?
因为多版本所有的资源请求(除了ajax等除外)每次都会走一次灰度的 判断逻辑。
如果是的话,那要是命中的路由没有匹配到多版本的path prefix呢,也就是说多版本的path prefix没有覆盖所有的请求场景?
如果没有并命中 到多版本的 path prefix,则会使用当前的Version
, Version
是一个兜底的逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. 支持多版本能力
场景是 在微前端的场景下一个主应用需要管理多个微应用, 实现根据不同路由映射不同的
Version
前端 版本