io.zipkin.reporter2:zipkin-sender-okhttp3:2.7.13
io.zipkin.reporter2:zipkin-reporter:2.7.13
io.zipkin.finagle2:zipkin-finagle_2.12: 2.0.11
io.zipkin.finagle2:zipkin-finagle-http_2.12:2.0.11
While testing Zipkin we noticed that after some time, very strange spans occur in Zipkin server:
{
"traceId": "647a1056a8015c7a",
"parentId": "2fc7a065ad3dc38a",
"id": "01e3b03ac3a2a9b9",
"name": "unknown",
"timestamp": 1563454909360000,
"localEndpoint": {
"serviceName": "unknown",
"ipv4": "127.0.0.1"
},
"annotations": [
{
"timestamp": 1563454909360000,
"value": "finagle.flush"
}
],
"tags": {
"clnt/response_payload_bytes": "3132"
}
}
It messed up completely the UI as we can see mainly "unknown" services.
Those spans are sent in zipkin2.finagle.SpanRecorder as they still exist in spanMap after the deadline.
void flush(Time deadline) {
Iterator i = this.spanMap.values().iterator();
while(i.hasNext()) {
MutableSpan span = (MutableSpan)i.next();
if (span.started().$less$eq(deadline)) {
i.remove();
span.addAnnotation(deadline, "finagle.flush");
this.report(span);
}
}
}
It turned up that those spans are just binary annotations generated by com.twitter.finagle.filter.PayloadSizeFilter.
The problem is that they are recorded right after other spans with a given traceId are sent to Zipkin server
if (span.isComplete()) {
this.spanMap.remove(record.traceId(), span);
this.report(span);
}
and the map is cleared for that particular id.
In consequence finagle's binary annotations cannot be merged with other spans and wait in the map till the flush.
Any ideas how to tackle this issue?