doc: add diagnostics_channel bypass API documentation#64250
Open
DivyanshuX9 wants to merge 6 commits into
Open
doc: add diagnostics_channel bypass API documentation#64250DivyanshuX9 wants to merge 6 commits into
DivyanshuX9 wants to merge 6 commits into
Conversation
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>
There was a problem hiding this comment.
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(), andtracingChannel.subscribe()to include anoptions.bypassIdparameter. - 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 | ||
| --> |
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 on lines
+289
to
+291
| request('https://my-apm-backend.example.com/traces', { | ||
| method: 'POST', | ||
| }); |
Comment on lines
+315
to
+317
| request('https://my-apm-backend.example.com/traces', { | ||
| method: 'POST', | ||
| }); |
| // bypass() works across Promise boundaries | ||
| await bypass(kMyTracer, async () => { | ||
| await someAsyncOperation(); // still bypassed | ||
| channel('http.client.request').publish(data); // subscriber skipped |
| bypass(kMyTracer, () => { | ||
| setImmediate(() => { | ||
| // Still bypassed here | ||
| channel('http.client.request').publish(data); |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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