-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
contrib/trace/otlpgrpc: grpc connection to opentelemetry collector authentication failed #3893
Comments
OpenTelemetry Collector 中获取 token hander 的相关代码 https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/bearertokenauthextension/bearertokenauth.go#L187 |
建议参考自定义一个 OpenTelemetry client。 https://github.com/gogf/gf/blob/master/example/trace/provider/grpc/main.go |
@houseme 我知道可以自己实现,但我更希望至少在文档上说明清楚,避免后续的人踩同样的坑 |
@houseme I know I can implement it myself, but I would rather at least explain it clearly in the documentation to avoid subsequent people falling into the same trap. |
辛苦您补充一下文档内容,感谢🙏 |
Could you please add the content of the document, thank you🙏 |
Go version
go1.20
GoFrame version
2.7.0
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
github.com/gogf/gf/contrib/trace/otlpgrpc/v2
上传数据到 OpenTelemetry Collector,如配置
然后使用
这将会报告认证失败
traces export: rpc error: code = Unknown desc = authentication didn't succeed
为什么会这样?
经过一天的排查我发现了问题原因
在例子中 https://github.com/gogf/gf/blob/master/example/trace/otlp/grpc/main.go 这里使用的阿里云
同时根据阿里云文档 https://help.aliyun.com/zh/arms/tracing-analysis/connect-opentelemetry-to-tracing-analysis 和 https://help.aliyun.com/zh/opentelemetry/user-guide/connect-to-managed-service-for-opentelemetry-and-authenticate-clients
这里的认证头是使用
Authentication
实现的所以在 https://github.com/gogf/gf/blob/master/contrib/trace/otlpgrpc/otlpgrpc.go#L60 固定了hander
但是在 OpenTelemetry Collector 中是用
authorization
来接受认证头的,所以这导致认证失败虽然只找到这个说明 https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configgrpc/README.md 和 https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configauth/README.md
但我实测确实是用
authorization
能认证通过期望这个能调整这个内容,或者在例子中额外说明,这个只适用于阿里云而可能不适用于其他接收器
What did you see happen?
报错
traces export: rpc error: code = Unknown desc = authentication didn't succeed
What did you expect to see?
不应该报错
The text was updated successfully, but these errors were encountered: