Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit b99ff15

Browse files
tcolgatekjin
authored andcommitted
fix: properly split low/high for 128-bit spans (#77)
1 parent 069a5b4 commit b99ff15

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • packages/opencensus-exporter-jaeger/src/jaeger-driver

packages/opencensus-exporter-jaeger/src/jaeger-driver/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ export function spanToThrift(span: Span) {
5959

6060
const spanLogs = [];
6161
const unsigned = true;
62-
const length = span.spanContext.traceId.length;
6362
const parentSpan = span.parentSpanId ? Utils.encodeInt64(span.parentSpanId) :
6463
ThriftUtils.emptyBuffer;
6564

65+
const traceId =
66+
`00000000000000000000000000000000${span.spanContext.traceId}`.slice(-32);
67+
68+
const high = traceId.slice(0, 16);
69+
const low = traceId.slice(16);
70+
6671
return {
67-
traceIdLow: Utils.encodeInt64(span.spanContext.traceId),
68-
traceIdHigh: ThriftUtils.emptyBuffer,
72+
traceIdLow: Utils.encodeInt64(low),
73+
traceIdHigh: Utils.encodeInt64(high),
6974
spanId: Utils.encodeInt64(span.spanContext.spanId),
7075
parentSpanId: parentSpan,
7176
operationName: span.name,

0 commit comments

Comments
 (0)