kratos
kratos copied to clipboard
[Feature] 使用http.NewClient及log 遇到caller重复的问题
当我使用kratos自带的http.NewClient时,caller打印的是tracing.go:64, 而我在外部重新设置caller时却发现多了一个caller, 而没有进行覆盖。
这是代码:
logger = log.With(logger, "caller", log.Caller(9))
return http.NewClient(
context.Background(),
http.WithEndpoint("127.0.0.1:8081"),
http.WithTimeout(1*time.Second),
http.WithMiddleware(
recovery.Recovery(),
tracing.Client(),
logging.Client(logger),
metrics.Client(),
),
)
这是打印日志
ERROR caller=test.go:81 ts=2022-09-01T11:38:55+08:00 caller=tracing.go:64 service.id=MacBook-Pro.local trace.id= span.id= kind=client component=http operation=/api.local.v1.Test/Test1 args=
code=500 reason= stack=error: code = 500 reason = message = metadata = map[] cause = proto: syntax error (line 1:1): invalid value < latency=3.00302075
Environment:
- Kratos version (use
kratos -v
): kratos version v2.4.0 - Go version (use
go version
):go version go1.17.6 darwin/arm64 - OS (e.g:
cat /etc/os-release
): MacOS 12.0.1
https://github.com/go-kratos/kratos/issues/2346
@shenqidebaozi 这个功能将会加入新的go-kratos中么
Hi, @shcw! I'm Dosu, and I'm helping the kratos team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, the issue is about encountering duplicate caller information when using http.NewClient
and log
in Kratos. It seems that when setting a new caller externally, an additional caller is added instead of replacing the existing one. Currently, the issue remains unresolved and there has been one comment from you asking for more information.
Could you please let us know if this issue is still relevant to the latest version of the kratos repository? If it is, please comment on the issue to let the kratos team know. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the kratos project!