GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||
GeezerVison is showing github.com — inspector: add initial support for network inspection by cola119 · Pull Request #53593 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
499ab30 to
6a9a7cf
Compare
|
CC @nodejs/undici regarding support for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey, this is incredibly cool. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, at the very least we should probably integrate with fetch/undici, it's hookable already through the dispatcher so it shouldn't be too hard (before this is stable, not to block this PR) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think the fetch api is also very important and I hope it can be supported |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@benjamingr I wasn't aware of undici's dispatcher feature, and I've now seen that undici includes diagnostics channels. I'm thinking using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I received this update before taking a shower, and this piece can finally be pushed forward, which is great. About two weeks ago, I developed a library for this issue, and some key ideas should be useful: The 'v8 inspector' lacks a network domainIt is used How to listen for HTTP/HTTPS requests?Basic ideas
Key points
How to make full use of the
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
One thing I was prototyping years ago was implementing Inspector domains in the user land, in JS. I.e. instead of piping Another thing we discussed a lot in the past is that Network domain in Node should be reversed as most users will be interested in debugging server application. There should be Chrome DevTools at the time was very adamant not to reuse Chrome domains for the domains not in V8. Please rename this domain to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Could we implement it in terms of diagnostic channnels that external libs (undici) can just hook into? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I completely agree, and I also believe that the network domain in Node should be reversed. Now we can actually extend the v8 inspector launched by the node, but it is more related to remote debugging, and due to domain limitations, network and other domains cannot be implemented. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note needs both HTTP server and HTTP client support... It would be invaluable to be able to see request that was received and what was sent to other microservices. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fc0ed45 to
5656be6
Compare
|
@nodejs/undici For network inspection on fetch API, we need undici's diagnostics_channel to support a hook when body is received. Has there been any progress on nodejs/undici#1342? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I would like to confirm if listening to network requests through the undici library diagnostics.channel is compatible with previous libraries? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@GrinZero I'm going to add as many features of the @eugeneo I need your advice on how to properly define and implement the custom |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
5656be6 to
1c754b4
Compare
|
I am wondering if it is possible to be more open and allow the node v8 inspector to directly expose the websocket server. This way, developers can not only operate devtool as a CDP client, but also extend devtool as a CDP server in the future. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1c754b4 to
6e727ee
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Based on the test results, consuming response data and entering flowing mode in the diagnostics_channel hook is causing some issues in the core. Any ideas?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Show the issues?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/nodejs/node/actions/runs/9696727280/job/26759268382?pr=53593
I'll investigate and summarize the issues later.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah this seems wrong - we can't consume the request this way :D
We'd need to 'tee' the stream (discussions happening elsewhere) though with the inspector cloning it should also be fine.
I think for this PR it would make sense to exclude request bodies and do it in a follow up PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Dropped support for response body inspection for now. fbf5a31af46d564c7530d70e93b672cdd22c448f
@benjamingr Do you have any discussion links for reference?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We could add fetch support via nodejs/undici#2701. Generically I think we should add some APIs to let devs integrate 3rd party clients. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
+1 to this being diagnostics_channel based and +1 for letting userland tools integrate with it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6e727ee to
b874c90
Compare
|
Landed in a523c34 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #53593 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
|
I hacked a bit in DevTools frontend and documented the results here. Node.js implementation of the Network domain is incomplete still. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Notable changes: deps: * (SEMVER-MINOR) V8: backport 7857eb34db42 (Stephen Belanger) #53997 http: * (SEMVER-MINOR) add diagnostics channel `http.client.request.error` (Kohei Ueno) #54054 inspector: * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib,src: * drop --experimental-network-imports (Rafael Gonzaga) #53822 meta: * add jake to collaborators (jakecastelli) #54004 module: * (SEMVER-MINOR) add --experimental-strip-types (Marco Ippolito) #53725 * (SEMVER-MINOR) unflag detect-module (Geoffrey Booth) #53619 stream: * (SEMVER-MINOR) expose DuplexPair API (Austin Wright) #34111 test_runner: * (SEMVER-MINOR) fix support watch with run(), add globPatterns option (Matteo Collina) #53866 * (SEMVER-MINOR) refactor snapshots to get file from context (Colin Ihrig) #53853 * (SEMVER-MINOR) add context.filePath (Colin Ihrig) #53853 PR-URL: #54123
Notable changes: deps: * (SEMVER-MINOR) V8: backport 7857eb34db42 (Stephen Belanger) #53997 http: * (SEMVER-MINOR) add diagnostics channel `http.client.request.error` (Kohei Ueno) #54054 inspector: * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib,src: * drop --experimental-network-imports (Rafael Gonzaga) #53822 meta: * add jake to collaborators (jakecastelli) #54004 module: * (SEMVER-MINOR) add --experimental-strip-types (Marco Ippolito) #53725 stream: * (SEMVER-MINOR) expose DuplexPair API (Austin Wright) #34111 test_runner: * (SEMVER-MINOR) fix support watch with run(), add globPatterns option (Matteo Collina) #53866 * (SEMVER-MINOR) refactor snapshots to get file from context (Colin Ihrig) #53853 * (SEMVER-MINOR) add context.filePath (Colin Ihrig) #53853 PR-URL: #54123
Notable changes: deps: * (SEMVER-MINOR) V8: backport 7857eb34db42 (Stephen Belanger) #53997 http: * (SEMVER-MINOR) add diagnostics channel `http.client.request.error` (Kohei Ueno) #54054 inspector: * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib,src: * drop --experimental-network-imports (Rafael Gonzaga) #53822 meta: * add jake to collaborators (jakecastelli) #54004 module: * (SEMVER-MINOR) add --experimental-strip-types (Marco Ippolito) #53725 stream: * (SEMVER-MINOR) expose DuplexPair API (Austin Wright) #34111 test_runner: * (SEMVER-MINOR) fix support watch with run(), add globPatterns option (Matteo Collina) #53866 * (SEMVER-MINOR) refactor snapshots to get file from context (Colin Ihrig) #53853 * (SEMVER-MINOR) add context.filePath (Colin Ihrig) #53853 PR-URL: #54123
|
Saw this on the Node 22.6.0 release notes, super exciting! I'm going to get inspection support prioritized for VS Code's JS debugger soon 🙂 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
As I mentioned before, the network requests received through the
So is it possible for us to consider other ways to achieve network monitoring? For example, directly modifying the source code of HTTP and HTTPS, or hijacking the request methods of HTTP and HTTPS under specific conditions. However, I'm sorry, but for now, I can only provide assistance in terms of ideas on how to implement it. Unless I can learn how to debug the Here is also a brief introduction to my open source project. Before node fully supports network debugging, this library can be used. Among them, the monitoring of network requests is achieved through hijacking HTTP, HTTPS, and fetch libraries, which currently runs well and supports most devtool functions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've implemented some inspection in VS Code, but probably won't ship it in the current version since pretty much the only info we get (in stable 22.6.0) is that "a request to this URL happened." Once some support for information like status codes and bodies come in I'll be eager to flip the switch! not as pretty as chrome devtools, but only a couple hours of work ;) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@connor4312 Thank you for your quick work! This is an awesome feature 🤩. In the next release, we'll be adding additional information such as headers and status codes. You can track our progress through this issue: #53946 :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #53593 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
Notable changes: buffer: * optimize createFromString (Robert Nagy) #54324 inspector: * (SEMVER-MINOR) support `Network.loadingFailed` event (Kohei Ueno) #54246 * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib: * (SEMVER-MINOR) add EventSource Client (Aras Abbasi) #51575 repl: * doc-deprecate instantiating `node:repl` classes without `new` (Aviv Keller) #54842 src,lib: * (SEMVER-MINOR) add performance.uvMetricsInfo (Rafael Gonzaga) #54413 test_runner: * (SEMVER-MINOR) support module mocking (Colin Ihrig) #52848 tls: * (SEMVER-MINOR) add `allowPartialTrustChain` flag (Anna Henningsen) #54790 url: * (SEMVER-MINOR) implement parse method for safer URL parsing (Ali Hassan) #52280 vm: * (SEMVER-MINOR) introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY (Joyee Cheung) #54394 zlib: * deprecate instantiating classes without new (Yagiz Nizipli) #54708 PR-URL: #55170
Notable changes: buffer: * optimize createFromString (Robert Nagy) #54324 inspector: * (SEMVER-MINOR) support `Network.loadingFailed` event (Kohei Ueno) #54246 * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib: * (SEMVER-MINOR) add EventSource Client (Aras Abbasi) #51575 repl: * doc-deprecate instantiating `node:repl` classes without `new` (Aviv Keller) #54842 src,lib: * (SEMVER-MINOR) add performance.uvMetricsInfo (Rafael Gonzaga) #54413 test_runner: * (SEMVER-MINOR) support module mocking (Colin Ihrig) #52848 tls: * (SEMVER-MINOR) add `allowPartialTrustChain` flag (Anna Henningsen) #54790 url: * (SEMVER-MINOR) implement parse method for safer URL parsing (Ali Hassan) #52280 vm: * (SEMVER-MINOR) introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY (Joyee Cheung) #54394 zlib: * deprecate instantiating classes without new (Yagiz Nizipli) #54708 PR-URL: #55170
Notable changes: buffer: * optimize createFromString (Robert Nagy) #54324 inspector: * (SEMVER-MINOR) support `Network.loadingFailed` event (Kohei Ueno) #54246 * (SEMVER-MINOR) add initial support for network inspection (Kohei Ueno) #53593 lib: * (SEMVER-MINOR) add EventSource Client (Aras Abbasi) #51575 repl: * doc-deprecate instantiating `node:repl` classes without `new` (Aviv Keller) #54842 src,lib: * (SEMVER-MINOR) add performance.uvMetricsInfo (Rafael Gonzaga) #54413 test_runner: * (SEMVER-MINOR) support module mocking (Colin Ihrig) #52848 tls: * (SEMVER-MINOR) add `allowPartialTrustChain` flag (Anna Henningsen) #54790 url: * (SEMVER-MINOR) implement parse method for safer URL parsing (Ali Hassan) #52280 vm: * (SEMVER-MINOR) introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY (Joyee Cheung) #54394 zlib: * deprecate instantiating classes without new (Yagiz Nizipli) #54708 PR-URL: #55170
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.