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

在SDK API请求中支持context.Context #513

Open
emmansun opened this issue Jul 20, 2021 · 2 comments
Open

在SDK API请求中支持context.Context #513

emmansun opened this issue Jul 20, 2021 · 2 comments

Comments

@emmansun
Copy link

我们有时候需要集成trace tool,比如OpenTelemetry,来跟踪阿里服务的请求响应情况,但是目前所有API的Request都没有context.Context参数,难以做到per request trace。当然,如果可以做到和OpenTelemetry集成的内置支持就更好了。

@JacksonTian
Copy link
Contributor

这个功能支持起来恐怕有些困难。content.Context 是最近版本才支持的功能。老版本的用户会 break。

@xuyang2
Copy link

xuyang2 commented May 5, 2022

context 在 Go 1.7 版就被纳入官方标准库了,而 https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/go.mod 声明的已经是 go 1.13

如果想保持 API 兼容性的话,可以仿照标准库的做法,比如:

package net

func (d *Dialer) Dial(network, address string) (Conn, error) {
	return d.DialContext(context.Background(), network, address)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants