twitter/finagle

Zipkin spans generated remoteEndpoint.serviceName

Open

#778 创建于 2019年7月8日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Scala (8,864 star) (1,435 fork)batch import
help wanted

描述

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).

贡献者指南