Skip to content

Commit

Permalink
separate low & high trace id for jaeger (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhenchi <[email protected]>
  • Loading branch information
zhongzc authored Jun 23, 2021
1 parent 5194f6a commit b55a0a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func MiniSpansToJaegerTrace(
}

return Trace{
TraceID: traceID,
TraceIDLow: traceID,
ServiceName: serviceName,
Spans: retSpans,
}
Expand Down Expand Up @@ -102,9 +102,9 @@ func ThriftCompactEncode(

for _, span := range trace.Spans {
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(trace.TraceID))
encodeVarInt(&buf, zigzagFromI64(trace.TraceIDLow))
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(trace.TraceID))
encodeVarInt(&buf, zigzagFromI64(trace.TraceIDHigh))
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(span.SpanID))
buf = append(buf, 0x16)
Expand All @@ -115,9 +115,9 @@ func ThriftCompactEncode(
buf = append(buf, []byte{0x19, 0x1c, 0x15}...)
encodeVarInt(&buf, uint64(zigzagFromI32(int32(1 /* Follow from */))))
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(trace.TraceID))
encodeVarInt(&buf, zigzagFromI64(trace.TraceIDLow))
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(trace.TraceID))
encodeVarInt(&buf, zigzagFromI64(trace.TraceIDHigh))
buf = append(buf, 0x16)
encodeVarInt(&buf, zigzagFromI64(span.ParentID))
buf = append(buf, 0x00)
Expand Down
3 changes: 2 additions & 1 deletion jaeger/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type Span struct {
}

type Trace struct {
TraceID int64
TraceIDLow int64
TraceIDHigh int64
ServiceName string
Spans []Span
}

0 comments on commit b55a0a7

Please sign in to comment.