twitter/finagle

Support propagating 128-bit trace identifiers

オープン

#564 opened on 2016/10/27

 (11 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (1,435 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (8,864 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

When Finagle receives a 128-bit trace identifier, it should be able to propagate it without reducing its size to 64-bits.

Expected behavior

TraceId should have an extra field to carry the high bits of a 128-bit trace id. In other instrumentation, this is called traceIdHigh (or traceIdHi). This should be initialized to zero, and encoded if set.

For example, if serializing to the X-B3-TraceId header, when non-zero, traceIdHigh becomes the left-most 16 hex characters. If serializing to a buffer, it prefixes the existing traceId bytes at position 16 of a 40 (extended from 32) byte buffer.

Actual behavior

Currently, TraceId.traceId is a SpanId which is a 64-bit long in representation. This is serialized as a 16character hex X-B3-TraceId header or 8 bytes in the TraceId binary form (offset 16).

Until TraceId.traceIdHigh or similar exists, and the serialized forms are updated accordingly, any application propagating through finagle will downgrade from 128 to 64bit trace identifiers. While this is fine in the current state of zipkin, eventually, this will become a problem (ex when propagating out to a different tracing system that requires the original 128-bit id)

コントリビューターガイド