SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
447 stars 122 forks source link

异步数据上报展示错误 #118

Closed soooldier closed 3 years ago

soooldier commented 3 years ago

Describe the bug 调用代码大概如下

span1, _, _ := tracer.CreateLocalSpan(ctx, go2sky.WithOperationName("同步操作"))
// 异步操作,应用程序不需拿到结果
go func() {
    time.Sleep(3 * time.Second)
    span2, _, _ :=tracer.CreateLocalSpan(ctx, go2sky.WithOperationName("异步操作"))
    span2.End()
}()
span1.End()

SkyWalking UI展示效果:

image

期望展示效果:

image

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

wu-sheng commented 3 years ago

This is not a bug. This is about when and how you use ctx.

soooldier commented 3 years ago

不好意思请教一下,针对示例中的场景应该怎样使用ctx才是最佳实践呢?

haishenming commented 3 years ago

遇到一样的问题,同问,最佳实践。。。