doc: add diagnostics_channel bypass API documentation#64250
doc: add diagnostics_channel bypass API documentation#64250DivyanshuX9 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.
| #### `diagnostics_channel.bypass(key, fn[, thisArg[, ...args]])` | ||
|
|
||
| <!-- YAML | ||
| added: REPLACEME | ||
| --> |
There was a problem hiding this comment.
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
| - v14.17.0 | ||
| changes: | ||
| - version: REPLACEME | ||
| pr-url: https://github.com/nodejs/node/pull/63651 | ||
| description: Added `options.bypassId` parameter. |
| - v18.19.0 | ||
| changes: | ||
| - version: REPLACEME | ||
| pr-url: https://github.com/nodejs/node/pull/63651 | ||
| description: Added `options.bypassId` parameter. |
| - v18.19.0 | ||
| changes: | ||
| - version: REPLACEME | ||
| pr-url: https://github.com/nodejs/node/pull/63651 | ||
| description: Added `options.bypassId` parameter. |
| request('https://my-apm-backend.example.com/traces', { | ||
| method: 'POST', | ||
| }); |
| 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); |
| // 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>
|
will update the version after confirmation of #63651 merge and version it to be introduced |
|
@Flarna please have a look and tell me if i had miss something |
|
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. |
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