twitter/finagle

Zipkin spans generated remoteEndpoint.serviceName

Open

#778 aberto em 8 de jul. de 2019

Ver no GitHub
 (4 comments) (0 reactions) (0 assignees)Scala (1.435 forks)batch import
help wanted

Métricas do repositório

Stars
 (8.864 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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

Guia do colaborador