Skip to content

Commit

Permalink
Merge ce54776 into 8e2e2a9
Browse files Browse the repository at this point in the history
  • Loading branch information
sid-maddy committed Apr 5, 2021
2 parents 8e2e2a9 + ce54776 commit 9cce712
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ function deserializeSpanContext(serializedString: string): SpanContext | null {
if (headers.length !== 4) {
return null;
}
const [traceId, spanId, , flags] = headers;

const [_traceId, spanId, , flags] = headers;

const traceId = _traceId.padStart(32, '0');
const traceFlags = flags.match(/^[0-9a-f]{2}$/i) ? parseInt(flags) & 1 : 1;

return { traceId, spanId, isRemote: true, traceFlags };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('JaegerHttpTracePropagator', () => {

assert.deepStrictEqual(extractedSpanContext, {
spanId: '45fd2a9709dadcf1',
traceId: '9c41e35aeb6d1272',
traceId: '00000000000000009c41e35aeb6d1272',
isRemote: true,
traceFlags: TraceFlags.SAMPLED,
});
Expand All @@ -132,7 +132,7 @@ describe('JaegerHttpTracePropagator', () => {

assert.deepStrictEqual(extractedSpanContext, {
spanId: '5ac292c4a11a163e',
traceId: 'ac1f3dc3c2c0b06e',
traceId: '0000000000000000ac1f3dc3c2c0b06e',
isRemote: true,
traceFlags: TraceFlags.SAMPLED,
});
Expand Down

0 comments on commit 9cce712

Please sign in to comment.