Skip to content

doc: add diagnostics_channel bypass API documentation#64250

Open
DivyanshuX9 wants to merge 6 commits into
nodejs:mainfrom
DivyanshuX9:docs/diagnostics-channel-bypass
Open

doc: add diagnostics_channel bypass API documentation#64250
DivyanshuX9 wants to merge 6 commits into
nodejs:mainfrom
DivyanshuX9:docs/diagnostics-channel-bypass

Conversation

@DivyanshuX9

Copy link
Copy Markdown
Contributor

Documents the new bypass API introduced in #63651:

  • diagnostics_channel.bypass(key, fn[, thisArg[, ...args]])
  • channel.subscribe(handler, { bypassId })
  • channel.bindStore(store, transform, { bypassId })
  • tracingChannel.subscribe(handlers, { bypassId })

Includes full parameter docs, APM use case example,
multi-vendor coordination example, async boundary examples,
and both MJS and CJS code samples throughout.

Refs: #63651

Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
… changes entries

Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
Copilot AI review requested due to automatic review settings July 1, 2026 21:14
@nodejs-github-bot nodejs-github-bot added diagnostics_channel Issues and PRs related to diagnostics channel doc Issues and PRs related to the documentations. labels Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents the new diagnostics_channel bypass API (from #63651) so observability tooling can opt specific subscribers/stores into suppression during internal operations, avoiding recursive instrumentation.

Changes:

  • Added new API docs for diagnostics_channel.bypass(key, fn[, thisArg[, ...args]]) with multiple examples (APM recursion avoidance, async propagation, multi-tool coordination).
  • Extended documentation for channel.subscribe(), channel.bindStore(), and tracingChannel.subscribe() to include an options.bypassId parameter.
  • Added cross-reference link for diagnostics_channel.bypass().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +248 to +252
#### `diagnostics_channel.bypass(key, fn[, thisArg[, ...args]])`

<!-- YAML
added: REPLACEME
-->

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since im not sure in which version the PR: 63651(marked as semver-minor) will land so i made a placeholder, for this continuation PR which contains changes and example in the docs

Comment on lines 581 to +585
- v14.17.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/63651
description: Added `options.bypassId` parameter.
Comment on lines 722 to +726
- v18.19.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/63651
description: Added `options.bypassId` parameter.
Comment on lines 998 to +1002
- v18.19.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/63651
description: Added `options.bypassId` parameter.
Comment thread doc/api/diagnostics_channel.md Outdated
Comment on lines +289 to +291
request('https://my-apm-backend.example.com/traces', {
method: 'POST',
});
Comment thread doc/api/diagnostics_channel.md Outdated
Comment on lines +315 to +317
request('https://my-apm-backend.example.com/traces', {
method: 'POST',
});
Comment thread doc/api/diagnostics_channel.md Outdated
// bypass() works across Promise boundaries
await bypass(kMyTracer, async () => {
await someAsyncOperation(); // still bypassed
channel('http.client.request').publish(data); // subscriber skipped
Comment thread doc/api/diagnostics_channel.md Outdated
bypass(kMyTracer, () => {
setImmediate(() => {
// Still bypassed here
channel('http.client.request').publish(data);
Comment thread doc/api/diagnostics_channel.md Outdated
Comment on lines +345 to +357
// bypass() works across Promise boundaries
await bypass(kMyTracer, async () => {
await someAsyncOperation(); // still bypassed
channel('http.client.request').publish(data); // subscriber skipped
});

// And across timers
bypass(kMyTracer, () => {
setImmediate(() => {
// Still bypassed here
channel('http.client.request').publish(data);
});
});
Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
Signed-off-by: Divyanshu Sharma <divyanshu88999@gmail.com>
@DivyanshuX9

Copy link
Copy Markdown
Contributor Author

will update the version after confirmation of #63651 merge and version it to be introduced

@DivyanshuX9

Copy link
Copy Markdown
Contributor Author

@Flarna please have a look and tell me if i had miss something

@Flarna

Flarna commented Jul 6, 2026

Copy link
Copy Markdown
Member

I still think docs and API change should come in on PR. That's the only way I know to ensure that we do not create a release with code included but without docs.
Once docs are in place it's by far easier for people to review in one shot and for you it's easier to keep implementation and docs in sync.

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

Labels

diagnostics_channel Issues and PRs related to diagnostics channel doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants