trace_events: add support for line-delimited JSON output
Adds a new --trace-event-format
command line option that may be
used to specify V8 Trace Event JSON output or a line-delimited
JSON variant.
By default, the V8 Trace Events format uses a root object with a
single trace_events: []
property. While there are some hackish
ways to process that format in a fully streaming model, newline
delimited JSON is a better general approach. However, as newline
delimited JSON is not yet supported by the V8 trace events viewer,
it cannot be the default.
This PR adds the option of using either...
node --trace-event-format ldjson --trace-events-enabled
node --trace-event-format json --trace-events-enabled
This also gives us the option of potentially adding other formats later on down the line.
/cc @ofrobots @AndreasMadsen @mcollina @nodejs/diagnostics
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