kratos icon indicating copy to clipboard operation
kratos copied to clipboard

[Feature] http timeout use grpc deadline

Open AtlanCI opened this issue 3 years ago • 2 comments

Please see the FAQ in our main README.md before submitting your issue.

Use case(s) - what problem will this feature solve?

在一个grpc服务中要使用http调用另一个服务超时设置能够继续使用grpc的设置。

Proposed Solution

将超时放置到http header中传递

Alternatives Considered

Additional Context

AtlanCI avatar Aug 16 '21 15:08 AtlanCI

有现成的哦:

opts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))

c.Http.Timeout 是配置的key, 可以从配置中心读,也可以从配置文件读

iamharvey avatar Aug 16 '21 15:08 iamharvey

这个好像不能跨主机传递,设置单机的是可以这个没问题。主要是传递.

AtlanCI avatar Aug 16 '21 17:08 AtlanCI

Hi, @AtlanCI! I'm Dosu, and I'm here to help the kratos team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, this issue is a feature request to add support for setting HTTP timeouts using gRPC deadlines in a gRPC service. The proposed solution is to pass the timeout value in the HTTP header. "iamharvey" has provided a code snippet as a possible implementation. You mentioned that the solution should be applicable to single machine setups.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the kratos repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your contribution to the kratos repository!

dosubot[bot] avatar Nov 02 '23 16:11 dosubot[bot]