fix(node): tracingChannel export missing in older node versions#18191
fix(node): tracingChannel export missing in older node versions#18191AbhiPrasad merged 1 commit intodevelopfrom
tracingChannel export missing in older node versions#18191Conversation
| const injectedChannel = tracingChannel('orchestrion:pino:pino-log'); | ||
| const integratedChannel = tracingChannel('pino_asJson'); | ||
| const injectedChannel = diagnosticsChannel.tracingChannel('orchestrion:pino:pino-log'); | ||
| const integratedChannel = diagnosticsChannel.tracingChannel('pino_asJson'); |
There was a problem hiding this comment.
Bug: Import Change Hides tracingChannel Bug
Changing from named import to namespace import doesn't fix the missing tracingChannel export in Node <18.19.0. The code will now throw a runtime error (diagnosticsChannel.tracingChannel is not a function) when setup executes instead of an import-time error. This makes debugging harder and violates the documented Node version requirement without any runtime check or graceful fallback.
There was a problem hiding this comment.
This integration is only supported on Node where tracingChannel is supported
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
| const injectedChannel = diagnosticsChannel.tracingChannel('orchestrion:pino:pino-log'); | ||
| const integratedChannel = diagnosticsChannel.tracingChannel('pino_asJson'); |
There was a problem hiding this comment.
Bug: Pino integration crashes on Node < 18.19.0 due to diagnosticsChannel.tracingChannel() being undefined.
Severity: CRITICAL | Confidence: 0.98
🔍 Detailed Analysis
The pino integration will crash with a "TypeError: diagnosticsChannel.tracingChannel is not a function" at runtime when its setup() function is called on Node versions < 18.19.0. This occurs because the code at lines 125-126 attempts to call diagnosticsChannel.tracingChannel() without checking if the method exists, as diagnosticsChannel.tracingChannel is undefined on these older Node versions. This unexpected crash violates the integration's documented Node version requirements.
💡 Suggested Fix
Implement version checks for diagnosticsChannel.tracingChannel() similar to SentryNodeFetchInstrumentation.ts to ensure it's only called on Node >= 18.19.0, or handle the undefined case gracefully by providing a fallback or no-op.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/node-core/src/integrations/pino.ts#L125-L126
Potential issue: The pino integration will crash with a "TypeError:
diagnosticsChannel.tracingChannel is not a function" at runtime when its `setup()`
function is called on Node versions < 18.19.0. This occurs because the code at lines
125-126 attempts to call `diagnosticsChannel.tracingChannel()` without checking if the
method exists, as `diagnosticsChannel.tracingChannel` is `undefined` on these older Node
versions. This unexpected crash violates the integration's documented Node version
requirements.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2618499
I guess this got through CI because we test latest 18 rather than 18.0.0.
This breaks some supported Electron versions which are using >18.0.0 but <18.19.0.
This wont have impacted almost anyone else because Otel requires 18.19.0!