diff --git a/ext/telemetry/telemetry.ts b/ext/telemetry/telemetry.ts index 1d8292fb98899a..6b92136459d727 100644 --- a/ext/telemetry/telemetry.ts +++ b/ext/telemetry/telemetry.ts @@ -1093,6 +1093,17 @@ export function bootstrap( default: break; } + + if (TRACING_ENABLED || METRICS_ENABLED) { + const otel = globalThis[SymbolFor("opentelemetry.js.api.1")] ??= {}; + if (TRACING_ENABLED) { + otel.tracing = new TracerProvider(); + otel.context = new ContextManager(); + } + if (METRICS_ENABLED) { + otel.metrics = new MeterProvider(); + } + } } export const telemetry = {