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

net/http/blademaster & net/rpc/warden(warden) client 支持透明降级(fallback) #19

Closed
Terry-Mao opened this issue Apr 23, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Terry-Mao
Copy link
Member

背景

部分服务在后端 service 500 后需要做降级处理,目前降级代码大部分嵌入下业务代码中,编写比较繁琐。http 和 gRPC 的 client 可以提供透明降级功能,并提供更多的降级选项

功能(TBD)

  • 根据指定错误码进行降级

  • 降级粒度到单个 API

  • 多级降级支持

降级选项(TBD)

  • callbacb 在 client 收到指定错误码时调用预先设定的 callback 函数生成 response 内容

  • cache 功能,client 能够 cache 请求,收到指定错误码时返回上次成功的结果

功能实现(TBD)

gRPC

方案一: 代码生成

生成新的 fallback client wrapper 已有的 client interface 缺点: 需要代码生成

方案二: interceptor

缺点:需要业务方知道每个 RPC method 的名称

http

http 实现比较简单直接拦截

@Terry-Mao Terry-Mao added the enhancement New feature or request label Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants