Zipkin spans generated remoteEndpoint.serviceName
One line summary of the issue here.
Expected behavior
ServerAddr instances created with a service name.
Actual behavior
finagle-core_2.12, version: 19.2.0 finagle-zipkin-core_2.12, version: 19.2.0
Spans regarding remote service invocations are generated without remoteEndpoint.serviceName.
In consequence, it breaks dependencies’s generation and presentation on Zipkin-server UI.
Example span:
{
"traceId": "88cc17d6380b051d",
"parentId": "ffa09b4d21723f1c",
"id": "e1ddba2b956d4f49",
"kind": "CLIENT",
"name": "post",
"timestamp": 1562073043328000,
"duration": 855000,
"localEndpoint": {
"serviceName": "demoClient",
"ipv4": "127.0.0.1"
},
"annotations": [{
"timestamp": 1562073044091000,
"value": "ws"
},
{
"timestamp": 1562073044179000,
"value": "wr"
}],
"tags": {
"clnt/finagle.label": "auth",
"clnt/finagle.version": "19.2.0",
"clnt/request_payload_bytes": "840",
"http.uri": "/auth/realms/ING_MAIN/protocol/openid-connect/token"
}
}
We are lacking smth:
"remoteEndpoint": {
"serviceName": "auth"
}
Steps to reproduce the behavior
[https://groups.google.com/forum/embed/#!topic/zipkin-user/8nan_JDShHE]
During discussion and analysis it turned out that Zipkin libraries rely on
ServerAddr(ia: InetSocketAddress) extends Annotation (from com.twitter.finagle.tracing.Annotation) to generate a remoteEndpoint.
object Annotation {
/*......*/
final case class ServerAddr(ia: InetSocketAddress) extends Annotation
final case class LocalAddr(ia: InetSocketAddress) extends Annotation
final case class BinaryAnnotation(key: String, value: Any) extends Annotation {
def this(key: String, value: ByteBuffer) = this(key, value: Any)
}
}
To overcome that issue, Zipkin needs to have a String value of a remote service name
provided as an argument of ServerAddr constructor ie. ServerAddr(serviceName: String, ia: InetSocketAddress).
Hi @tmichnik1981, thanks for reporting. I'll try to look into this soon.
Hi @tmichnik1981, I talked this over with a few folks internally this morning. This is something that we would like to have, and we would welcome a pull request in this area. However, it's also not something that on its own, we're likely to work on ourselves anytime soon.
So if you're interested in submitting a pull request, or if you're not but someone else is, we would welcome a contribution here. Thanks.
@ryanoneill I'd like to work on this, could you give me a heads-up on where to start?
@flostadler Thanks for doing it! First of all, I'm not an expert in this area. It looks like in finagle side we should provide a serviceName for ServerAddr. And this needs to collab with zipkin probably somewhere here to make it be able to generate a remoteEndpoint.