From 1a13d1dde145197309be397e35904aa032ea46ce Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 27 Jul 2020 14:35:32 -0400 Subject: [PATCH] style: rename context keys and move comment --- .../src/context/propagation/B3Propagator.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts b/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts index 3754617298c..03036697353 100644 --- a/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts +++ b/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts @@ -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; @@ -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,