有没有办法在Go中启用HTTP2请求和响应的详细跟踪?

huangapple go评论95阅读模式
英文:

Is there any way to enable detailed tracing of http2 requests and responses in Go?

问题

有没有办法在GO中启用http2请求和响应的详细跟踪?

我希望能够记录连接尝试、超时和请求传输,以便在事后诊断生产问题。

在开发过程中使用Stracing是可以的,但它对于确定问题的详细信息并不有用。

谢谢。

英文:

Is there any way to enable detailed tracing of http2 requests and responses in GO?

I would like to be able to log connection attempts, timeouts, and transmission of requests so that I can diagnose production problems after the fact.

Stracing is fine during development, but it not useful for determining the details of problems after they occur.

Thank you

答案1

得分: 5

你可以设置GODEBUG=http2debug=1GODEBUG=http2debug=2环境变量。

示例:

 env GODEBUG=http2debug=2 go run something.go

来源:http://tip.golang.org/pkg/net/http/

英文:

You can set the GODEBUG=http2debug=1 or GODEBUG=http2debug=2 environment variable.

Example:

 env GODEBUG=http2debug=2 go run something.go

source: http://tip.golang.org/pkg/net/http/

huangapple
  • 本文由 发表于 2016年4月9日 14:11:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/36513391.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定