[WIP] process: add process.[start|stop]TracingAgent()
Work in progress. Do not land. Not ready for CI
Ping @nodejs/diagnostics ...
One of the identified limitations of the v8 trace event support is that it is not currently possible to enable it at runtime. This PR is an attempt to start working towards enabling that capability.
So far it's pretty simple:
process.startTracingAgent('list,of,categories'); // returns true if agent was started as a result of this call, false otherwise
process.stopTracingAgent(); // returns true if agent was stopped, false otherwise
If the --trace-events--enabled
command-line flag is used, then both of these are non-ops that will return false
.
There are several key questions:
-
Is it safe to allow starting and stopping of the tracing agent dynamically like this? Note that starting will cause the existing
node_trace.1.log
to be overwritten each time, just like starting a new trace. We should be able to allow better handling of that once https://github.com/nodejs/node/pull/18480 lands. -
Is this the way that we should allow the tracing to be enabled/disabled dynamically at runtime? Is there an alternative that would work better?
-
There's currently no indication at the JS layer that tracing is enabled or disabled. Does there need to be and what form should that take (simple
process.traceEnabled
flag, perhaps?) -
Is this barking up the wrong tree entirely? If so, what alternate route should we take?
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
process, trace_events