Skip to content

Commit

Permalink
style: rename context keys and move comment
Browse files Browse the repository at this point in the history
  • Loading branch information
srjames90 committed Jul 27, 2020
1 parent 9e7988c commit 1a13d1d
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ export const X_B3_SPAN_ID = 'x-b3-spanid';
export const X_B3_SAMPLED = 'x-b3-sampled';
export const X_B3_PARENT_SPAN_ID = 'x-b3-parentspanid';
export const X_B3_FLAGS = 'x-b3-flags';
export const PARENT_SPAN_ID_KEY = Context.createKey(X_B3_PARENT_SPAN_ID);
export const DEBUG_FLAG_KEY = Context.createKey(X_B3_FLAGS);
export const PARENT_SPAN_ID_KEY = Context.createKey(
'OpenTelemetry Context Key B3 Parent Span Id'
);
export const DEBUG_FLAG_KEY = Context.createKey(
'OpenTelemetry Context Key B3 Debug Flag'
);
const VALID_TRACEID_REGEX = /^([0-9a-f]{16}){1,2}$/i;
const VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
const INVALID_ID_REGEX = /^0+$/i;
Expand Down Expand Up @@ -67,10 +71,9 @@ export class B3Propagator implements HttpTextPropagator {
// the sampled flag shouldn't be propagated as well.
if (debug === '1') {
setter(carrier, X_B3_FLAGS, debug);
}
// We set the header only if there is an existing sampling decision.
// Otherwise we will omit it => Absent.
else if (spanContext.traceFlags !== undefined) {
} else if (spanContext.traceFlags !== undefined) {
// We set the header only if there is an existing sampling decision.
// Otherwise we will omit it => Absent.
setter(
carrier,
X_B3_SAMPLED,
Expand Down

0 comments on commit 1a13d1d

Please sign in to comment.