feat: support custom ctx key to pass to downstream in Service-Inline #1709
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.
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
在合并编译场景下,支持特定的 ctx key 传递给下游
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en: Service-Inline is a form of ByteDance's internal service integration, running the upstream and downstream within the same process.. However, to ensure isolation and consistency with RPC calls, the ctx key passed during Service-Inline must conform to the metainfo specification. However, since it's within a single process, data can be stored within a specific key, and the downstream can simply assert this structure for use. This reduces serialization compared to passing data via IDL.
Note: Due to package isolation, using this feature requires ensuring that the package of the passed structure is isolated.
zh(optional): 合并编译是字节跳动内部服务合并的一种形态,将上游和下游运行在同一个进程内。但是为了隔离性以及与 RPC 调用时的一致性,合并编译传递的 ctx key 需要满足 metainfo 规范。然而既然在一个进程内,可以将一些数据塞到特定的 key 中,下游直接断言出来这个结构体使用就可以。相比通过 IDL 传递来说,可以减少序列化的次数。
注意:由于包的隔离性,使用该 feature 时必须保证传递的结构体的包时可以被隔离的。
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: