twitter/finagle

Zipkin spans generated remoteEndpoint.serviceName

開放

#778 建立於 2019年7月8日

 (4 則留言) (0 個反應) (0 位負責人)Scala (1,435 個分叉)batch import
help wanted

倉庫指標

星標
 (8,864 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南