Skip to content

Commit

Permalink
fix(propagator-jaeger): zero pad extracted trace id to 32 characters
Browse files Browse the repository at this point in the history
fixes #1983
  • Loading branch information
sid-maddy committed Mar 2, 2021
1 parent e00134e commit 7d543ce
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 7d543ce

Please sign in to comment.