-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(node): tracingChannel export missing in older node versions
#18191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { tracingChannel } from 'node:diagnostics_channel'; | ||
| import * as diagnosticsChannel from 'node:diagnostics_channel'; | ||
| import type { Integration, IntegrationFn, LogSeverityLevel } from '@sentry/core'; | ||
| import { | ||
| _INTERNAL_captureLog, | ||
|
|
@@ -122,8 +122,8 @@ const _pinoIntegration = defineIntegration((userOptions: DeepPartial<PinoOptions | |
| }, | ||
| }); | ||
|
|
||
| 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'); | ||
|
Comment on lines
+125
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Pino integration crashes on Node < 18.19.0 due to 🔍 Detailed AnalysisThe pino integration will crash with a "TypeError: diagnosticsChannel.tracingChannel is not a function" at runtime when its 💡 Suggested FixImplement version checks for 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. Reference_id: 2618499 |
||
|
|
||
| function onPinoStart(self: Pino, args: PinoHookArgs, result: PinoResult): void { | ||
| if (!shouldTrackLogger(self)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Import Change Hides
tracingChannelBugChanging from named import to namespace import doesn't fix the missing
tracingChannelexport in Node <18.19.0. The code will now throw a runtime error (diagnosticsChannel.tracingChannel is not a function) whensetupexecutes 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This integration is only supported on Node where tracingChannel is supported