Node: proposal: programmatically expose the V8 inspector URL

Created on 22 Feb 2017  Â·  9Comments  Â·  Source: nodejs/node

  • Version: 7.6.0 and later
  • Platform: all
  • Subsystem: diagnostics

This is a feature request to add a method to the v8 module that exposes the V8 inspector URL if the process has been started with --inspect. The motivation for this feature is to conveniently add links or buttons to a website that the developer can click to open the V8 inspector.

This is a hypothetical API:

$ node --inspect=dev.example.com:1337
> require('v8').getInspectorUri()
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=dev.example.com:1337/8fe96e86-fa03-4a24-b21d-2ce3725e479e

$ node
> require('v8').getInspectorUri()
null
feature request inspector

Most helpful comment

The requested feature is now provided in inspector.url(), so closing.

All 9 comments

Should be easy enough to do but let's see what @nodejs/v8-inspector thinks.

Sounds like a good idea to me. I think it should probably not be on the V8 module though?

We have plans of introducing bindings for inspector API (it is currently blocked on inspector becoming the default debug API, e.g. by installing the debug signal handler). I believe we could expose this url as a part of that API. API details are still TBD (e.g. I did not even open a pull request)...

FWIW you can get the URI and other metadata like the UUID from the JSON returned from http://localhost:9229/json/list (or http://localhost:9229/json) too. See https://github.com/nodejs/node/pull/11207 for an example of that output.

@ofrobots @cristiancavalli @eugeneo are working on providing a JS API to Inspector in general, perhaps access to the list JSON object could be part of that API and cover this request too.

/cc @nodejs/diagnostics

This seems like a good idea. Perhaps even one step further ... an API that simply returns the same data as the /json/list endpoint.

As for where it should live, perhaps when running with --inspect, this can be exposed via process.inspectInfo() API. When running without --inspect, it would simply return undefined

WIP JS bindings version I have (
https://github.com/eugeneo/node/tree/js-bindings) has a project.inspector
object so it will be easy to expose targets there. But I am not sure what
it will take to land such an API change.

On Wed, Feb 22, 2017 at 8:48 AM James M Snell notifications@github.com
wrote:

This seems like a good idea. Perhaps even one step further ... an API that
simply returns the same data as the /json/list endpoint.

As for where it should live, perhaps when running with --inspect, this
can be exposed via process.inspectInfo() API. When running without
--inspect, it would simply return undefined

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/nodejs/node/issues/11496#issuecomment-281727949, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AARkrYsCgBAIOA_y0MiGiuGqHrlwBzZxks5rfGbagaJpZM4MIT8_
.

I think this URI should be also predictable and partially configurable from command line. As I mentioned in #11701 I'm working with remote debug and automated tools doesn't allow to extract this URI from node output.

Is this in progress? Stalled? Blocked? Help wanted? I guess /cc @eugeneo but really anyone that knows?

The requested feature is now provided in inspector.url(), so closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brekmister picture Brekmister  Â·  3Comments

loretoparisi picture loretoparisi  Â·  3Comments

srl295 picture srl295  Â·  3Comments

dfahlander picture dfahlander  Â·  3Comments

fanjunzhi picture fanjunzhi  Â·  3Comments