Skip to content

feat(tracing): export TRACING_CHANNELS with published channel names - #864

Open
RihanArfan wants to merge 1 commit into
unjs:mainfrom
RihanArfan:feat/tracing-channels-export
Open

RihanArfan wants to merge 1 commit into
unjs:mainfrom
RihanArfan:feat/tracing-channels-export

Conversation

@RihanArfan

@RihanArfan RihanArfan commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

unstorage/tracing publishes unstorage.<operation> tracing channels, but only exported the operation names as a type (TracedOperation). Subscribers had to hardcode the channel names at runtime.

This adds TRACING_CHANNELS, the list of channels that are published, and a TracingChannelName type. withTracing creates its channels from it, and a test checks that the list matches what storage operations publish.

Nitro uses it to check its own channel list (nitrojs/nitro#4904).

Summary by CodeRabbit

  • New Features
    • Added a list of available tracing channel names for Node.js storage operations.
    • Metadata operations now publish tracing events on their corresponding storage-operation channels, marked as metadata events.
  • Documentation
    • Expanded the Node.js tracing guide with channel and trace-context details, including an example for subscribing to tracing channels.

@RihanArfan
RihanArfan requested a review from pi0 as a code owner October 29, 2026 13:10
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

@RihanArfan is attempting to deploy a commit to the unjs Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9e0f179e-6423-49fc-82b7-d8e140b7a1e9
Commits

Reviewing files that changed from the base of the PR and between 5781aae and d4e5653.

Files selected for processing: 3
  • docs/1.guide/2.utils.md
  • src/tracing.ts
  • test/tracing.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The tracing module now exports its diagnostics-channel names and derives channel-backed operation types from that list. Tests check channel publication, and the guide documents subscriptions and metadata operation channels.

Changes: Tracing channels

Layer / File(s) Summary
Channel contract and routing
src/tracing.ts
TRACING_CHANNELS defines the channel names and supports derived operation types. Tracing builds its channel map from prefixed names and routes channel-backed operations through it.
Channel validation and guide
test/tracing.test.ts, docs/1.guide/2.utils.md
The test checks that operations publish the listed channels without duplicates. The guide shows how to subscribe to the channels and documents that metadata operations publish on their underlying operation’s channel with meta: true.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: pi0, logaretm

Merge Risk: Minimal · up to d4e56

The documented tracing behavior matches the implementation; no merge-blocking risk was found.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: exporting TRACING_CHANNELS with the published tracing channel names.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.08%. Comparing base (5781aae) to head (d4e5653).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #864   +/-   ##
=======================================
  Coverage   76.07%   76.08%           
=======================================
  Files          46       46           
  Lines        2688     2689    +1     
  Branches      654      655    +1     
=======================================
+ Hits         2045     2046    +1     
  Misses        578      578           
  Partials       65       65           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant