From 6211772db060804f501c0372d97539f3e0629471 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 22 Feb 2024 15:38:25 -0800 Subject: [PATCH] add a diagnostic warning if attempting to use instr-fetch in Node.js --- .../packages/opentelemetry-instrumentation-fetch/src/fetch.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index f8fc3a2c6a..7ec2348c49 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -470,6 +470,7 @@ export class FetchInstrumentation extends InstrumentationBase< if (isNode) { // Node.js v18+ *does* have a global `fetch()`, but this package does not // support instrumenting it. + this._diag.warn('this instrumentation is intended for web usage only, it does not instrument Node.js\'s fetch()') return; } if (isWrapped(fetch)) {