nodejs / nodejs/node

diagnostics_channel: add a channel for filesystem operations

Open
#65,330 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

What is the problem this feature will solve?

node:diagnostics_channel does not currently expose a built-in channel for filesystem operations performed through node:fs and node:fs/promises.

The proposed scope is the public filesystem APIs. Calls made directly by native addons or arbitrary native code do not need to be included in this contract.

What is the feature you are proposing to solve the problem?

Add a built-in tracing channel family for filesystem operations. One possible naming scheme is:

  • tracing:fs.operation:start
  • tracing:fs.operation:end
  • tracing:fs.operation:asyncStart
  • tracing:fs.operation:asyncEnd
  • tracing:fs.operation:error

The shared event object could contain:

  • operation: a stable operation name such as open, read, stat, readdir, or realpath.
  • api: sync, callback, promise, stream, or filehandle.
  • Path, source/destination, or file descriptor fields when applicable, preserving the value type passed by the caller.
  • result and error following the existing TracingChannel conventions.

Large read/write buffers should not be copied into event metadata. The exact publication layer—public API wrappers or the lowest shared internal filesystem layer—can be determined during implementation, but the documented payload should remain independent of internal FSReqCallback details.

Using one operation family with an operation field avoids requiring wildcard channel subscriptions while allowing subscribers to filter individual operations.

What alternatives have you considered?

Wrapping exports from node:fs and node:fs/promises is incomplete when references have already been captured and requires synchronization with named built-in ESM exports. async_hooks exposes asynchronous resource lifecycles rather than stable filesystem operation semantics and does not cover synchronous calls. Trace events use a different consumption API and payload contract.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the public node:fs and node:fs/promises APIs and the existing node:diagnostics_channel TracingChannel conventions; compare sync, callback, promise, stream, and filehandle paths. Resolve the publication layer and channel names while keeping the payload independent of FSReqCallback details. Done means supported public filesystem operations publish the documented lifecycle events and metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.