feat: experimental built-in tracing channel support#4001
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a new top-level Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
|
Looking good! The Sentry SDK is ready for release, but I see we have these items to tick down before release:
No rush or anything but can I help with those? |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/config/resolvers/tracing.ts (1)
5-9: Usedefufor config merging in tracing resolver.This resolver should use
defuto align with the coding guideline forsrc/config/**/*.{ts,js}files and match the pattern used in other resolvers likeruntime-config.tsandassets.ts.
defu(options.tracingChannel, { srvx: true, h3: true })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/config/resolvers/tracing.ts` around lines 5 - 9, Replace the manual object spread merge for options.tracingChannel with defu-based merging: import and use defu to merge the defaults { srvx: true, h3: true } into options.tracingChannel (i.e., call defu(options.tracingChannel, { srvx: true, h3: true })) so the tracing resolver follows the same merge pattern as runtime-config.ts and assets.ts and avoids overriding nested values; ensure defu is imported where tracing.ts uses options.tracingChannel.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/3.config/0.index.md`:
- Line 1204: Update the documentation text that describes TracingChannel so it
explicitly states the runtime support scope: change the Node.js-only phrasing to
indicate that the tracingChannel instrumentation is wired for Node.js and also
supports Bun, Deno, and the development preset; reference the configuration
key/name tracingChannel (or tracingChannel option) and update the sentence to
mention the published channels `srvx.request` and `h3.request` remain available
across those runtimes so readers know the feature is not Node-exclusive.
In `@src/config/resolvers/tracing.ts`:
- Around line 10-11: The code always pushes the plugin id
"#nitro/virtual/tracing" onto options.plugins, which can cause duplicate
registrations; update the logic around options.plugins (where options.plugins is
initialized and where you push) to first ensure options.plugins exists and then
only push "#nitro/virtual/tracing" if it's not already present (e.g., check with
includes/indexOf) so the tracing plugin is registered exactly once.
---
Nitpick comments:
In `@src/config/resolvers/tracing.ts`:
- Around line 5-9: Replace the manual object spread merge for
options.tracingChannel with defu-based merging: import and use defu to merge the
defaults { srvx: true, h3: true } into options.tracingChannel (i.e., call
defu(options.tracingChannel, { srvx: true, h3: true })) so the tracing resolver
follows the same merge pattern as runtime-config.ts and assets.ts and avoids
overriding nested values; ensure defu is imported where tracing.ts uses
options.tracingChannel.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 21f3decf-16b8-4a0d-bfc6-3a98468bd075
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
docs/3.config/0.index.mdsrc/build/virtual/_all.tssrc/build/virtual/tracing.tssrc/config/loader.tssrc/config/resolvers/tracing.tssrc/presets/_nitro/runtime/nitro-dev.tssrc/presets/bun/runtime/bun.tssrc/presets/deno/runtime/deno-server.tssrc/presets/node/runtime/node-server.tssrc/presets/standard/preset.tssrc/runtime/virtual/tracing.tssrc/types/config.ts
This PR adds a new nitro config
tracingChannel: true(or options) to enable built-in tracing channel support for internals.Currently adding for h3 and srvx + db0 and unstorage comming soon thanks to @logaretm ❤️)
Node.js tracing channel is availabe in Node.js, Deno, Bun and also Cloudflare workers so it is kinda a universal and very lightweight standard for tracing events.
TODO:
Example events: