| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
Failed to start CI⚠ No approving reviews found ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/21678728231 |
Sorry, something went wrong.
There was a problem hiding this comment.
Could you please expand on PR description on why this is needed? We have channels, tracingChannels and now windowChannel, it would be great to know for which kind of situations we need each one of them.
Sorry, something went wrong.
| added: REPLACEME | ||
| --> | ||
|
|
||
| > Stability: 1 - Experimental |
There was a problem hiding this comment.
| > Stability: 1 - Experimental | |
| > Stability: 1 - Experimental |
Perhaps 1.1 Active Development instead?
Sorry, something went wrong.
There was a problem hiding this comment.
The particular change is inherited from #61674. Do you want that made there? What about the new APIs in diagnostics_channel? Same status?
Sorry, something went wrong.
|
WindowChannel is mainly just to enable using syntax scopes, but is exposed as there are possible use cases where one may want to emit events around a block/scope without the greater complexity of TracingChannel. It's also replacing most of the internals of TracingChannel to make it more coherent since there seemed to be a lot of misunderstanding of how it worked. Now TracingChannel is just a WindowChannel around start + end, a WindowChannel around asyncStart + asyncEnd, and an error channel. |
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 98.24561% with 5 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #61680 +/- ##
==========================================
+ Coverage 89.71% 89.72% +0.01%
==========================================
Files 692 692
Lines 213986 214167 +181
Branches 41055 41077 +22
==========================================
+ Hits 191969 192153 +184
- Misses 14089 14102 +13
+ Partials 7928 7912 -16
... and 46 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
| @@ -282,6 +282,53 @@ const channelsByCollection = diagnostics_channel.tracingChannel({ | |||
| }); | |||
| ``` | |||
|
|
|||
| #### `diagnostics_channel.windowChannel(nameOrChannels)` | |||
There was a problem hiding this comment.
This name window channel is confusing. It's not related to the specific window API in JavaScript. It reads to me that it is a version of tracing channel that enables using support. I feel terms like scope could be a more intuitive name.
Sorry, something went wrong.
There was a problem hiding this comment.
I feel "scope" is an equally problematic name in that it makes many think of lexical scope which is typically associated with closures, which is exactly what this is explicitly trying to not be. Naming is hard. 🤷🏻
I'm happy to pick a different name if you have a better idea for one, but I'm not convinced "scope" is much better. I had also considered "block" but that also has weird associations with "blocking" which is again misleading. 😐
Sorry, something went wrong.
There was a problem hiding this comment.
I went with BoundedChannel. Hopefully that is clear and unique enough naming.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
That PR doesn't land cleanly on existing release lines and is using the using keyword, which is only available on main. I've added the labels |
Sorry, something went wrong.
PR-URL: #61680 Reviewed-By: James M Snell <jasnell@gmail.com>
|
@Qard The BoundedChannel constructor is publicly exposed here, whereas the TracingChannel constructor is not. Which way round do we want these? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This adds BoundedChannel, adds a using syntax equivalent to runStores, and modifies the internals of TracingChannel to use these to avoid closures in several places.
Why BoundedChannel?
Reviewers asked why a new class is needed instead of just using the existing channel() or tracingChannel() APIs. Here's the motivation:
vs channel(): A bare Channel has no built-in concept of start/end lifecycle events or store binding for async context propagation. BoundedChannel combines two channels with a withScope() / run() API that ties start → store entry → user code → end → store exit into a single unit, which a raw channel can't express.
vs tracingChannel(): TracingChannel is designed for tracing operations with async continuations (it has 5 events: start, end, asyncStart, asyncEnd, error). BoundedChannel is a simpler, synchronous-only primitive with just start and end. It is also used internally by TracingChannel to implement its call window and continuation window, making the code cleaner and removing several closure allocations.
The name "Bounded" reflects that the scope is bounded by the using block — start fires when the scope begins, end fires when it is disposed.
Depends on #61674
cc @nodejs/diagnostics