Skip to content

Commit 970a075

Browse files
committed
Add DEBUG_BUILD guard to shouldPropagateTraceForUrl debug logs
Restore the DEBUG_BUILD && prefix that was present in the original opentelemetry version, enabling bundlers to tree-shake the debug log calls and string constant in production builds.
1 parent 22dee47 commit 970a075

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/core/src/utils/tracePropagationTargets.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DEBUG_BUILD } from '../debug-build';
12
import type { CoreOptions as Options } from '../types-hoist/options';
23
import { debug } from './debug-logger';
34
import type { LRUMap } from './lru';
@@ -22,13 +23,13 @@ export function shouldPropagateTraceForUrl(
2223

2324
const cachedDecision = decisionMap?.get(url);
2425
if (cachedDecision !== undefined) {
25-
!cachedDecision && debug.log(NOT_PROPAGATED_MESSAGE, url);
26+
DEBUG_BUILD && !cachedDecision && debug.log(NOT_PROPAGATED_MESSAGE, url);
2627
return cachedDecision;
2728
}
2829

2930
const decision = stringMatchesSomePattern(url, tracePropagationTargets);
3031
decisionMap?.set(url, decision);
3132

32-
!decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
33+
DEBUG_BUILD && !decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
3334
return decision;
3435
}

0 commit comments

Comments
 (0)