-
Notifications
You must be signed in to change notification settings - Fork 380
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
连续请求情况下某些span会缺少duration属性 #19
Comments
@jjtyro 你好,具体是如何使用 SkyWalking 的哈。 |
在尝试SkyWalking的zipkin receiver,这个问题与后面是不是SkyWalking没有关系。 |
@jjtyro 好的。我来看下,之后给你同步结论。 |
@guanchao-yang Ok! |
@jjtyro 非常抱歉,虽然按照你的方法,我还是没有能够复现出的场景。通过部署的 Zipkin 服务端,随机选择几个上报的 Span,类似如下图所示: 然后,选择汇报的数据格式即 json,会有类似如下的显示: [
{
"traceId": "003660e8adb90f84",
"id": "af63ad4c86019caf",
"name": "http://127.0.0.1:8080/zipkin",
"timestamp": 1530620120564000,
"duration": 1000,
"annotations": [
{
"timestamp": 1530620120564000,
"value": "sr",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"timestamp": 1530620120565000,
"value": "ss",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
}
],
"binaryAnnotations": [
{
"key": "current.thread.name",
"value": "http-nio-8080-exec-3",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "local.app",
"value": "SOFATracerReportZipkin",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "method",
"value": "GET",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "req.size.bytes",
"value": "-1",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "request.url",
"value": "http://127.0.0.1:8080/zipkin",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "resp.size.bytes",
"value": "51",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "result.code",
"value": "200",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
},
{
"key": "span.kind",
"value": "server",
"endpoint": {
"serviceName": "http://127.0.0.1:8080/zipkin",
"ipv4": "10.15.233.42"
}
}
]
}
] 发现其 // Zipkin is in nanosecond
zipkinSpanBuilder.duration((sofaTracerSpan.getEndTime() - sofaTracerSpan.getStartTime()) * 1000);
|
我这边是出现这种状况的,环境:
每次通过上述shell脚本发送请求,都会产生这种效果。我更新下Sofa-tracer的代码,在你说的地方加日志,再看看。 |
@jjtyro 好的,有问题第一时间反馈到我哈。 |
@guanchao-yang 通过加日志确认了,如果耗时是0, 即sofaTracerSpan.getEndTime()、sofaTracerSpan.getStartTime()值相等时,zipkin的Builder最终不会输出duration. public Span.Builder duration(@Nullable Long duration) {
this.duration = duration != null && duration == 0L ? null : duration;
return this;
} zipkin.Span.toString 最后会调用到zipkin.internal.write(),里面有: if (value.duration != null) {
b.writeAscii(",\"duration\":").writeAscii(value.duration);
} Ok, 应该不是sofa的问题,接收端在某些运算处理时没对这种情况做判断。 |
@jjtyro 👍赞 |
为什么sofa-tracer取毫秒级做stratTime与endTime,而不是直接取微秒级? 一次处理在毫秒内完成是完全可能的。 |
@jjtyro 是可以取 |
@guanchao-yang I am trying.... |
@jjtyro Good Job!!!! |
sofa-tracer-sample-with-zipkin : sofa-tracer samples中的Demo
连续使用curl发送请求:
1.zipkin接收端的SkyWalking日志报错,因为在取duration属性时取到了空指针;
2.使用工具截取网络包,发现某些span少掉了duration属性。
下面是格式化后的局部报文内容,第二个span少了duration属性(应该是第二个trace吧):
The text was updated successfully, but these errors were encountered: