Skip to content

Commit 0650362

Browse files
authored
fix: otel symbol may not be exposed in some cases (#586)
1 parent 55d2378 commit 0650362

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/main/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import { context, propagation } from "npm:@opentelemetry/api";
77
import { W3CBaggagePropagator } from "npm:@opentelemetry/core@1";
88

99
// @ts-ignore See https://github.com/denoland/deno/issues/28082
10-
globalThis[Symbol.for("opentelemetry.js.api.1")].propagation =
11-
new W3CBaggagePropagator();
10+
if (globalThis[Symbol.for("opentelemetry.js.api.1")]) {
11+
globalThis[Symbol.for("opentelemetry.js.api.1")].propagation =
12+
new W3CBaggagePropagator();
13+
}
1214

1315
console.log("main function started");
1416
console.log(Deno.version);

0 commit comments

Comments
 (0)