Skip to content

src: allow adjusting trace events per file in cli

Rodrigo Muino Tomonari requested to merge github/fork/kjin/traces-per-file into master

This change proposes a new CLI flag --trace-event-traces-per-file that can be used to adjust the number of traces written to a file before rotating the file number. This is currently a hardcoded number (kTracesPerFile = 524288). I've added the ability to turn off rotation by specifying 0 as an argument -- it acts more like "infinity" in this case.

We still currently have the number of traces buffered before writing to disk hardcoded at 65536 (1024 chunks * 16 traces per chunk), so it's not really effective for the number of traces to be lower than this. Allowing users to adjust # of buffered traces might also be worthwhile, though I haven't included it yet.

The primary motivation for this is to disable file rotation -- which allows us to write continuously to a file pipe without ever closing the file for rotation purposes. But there might be merit in having smaller/larger trace files for other use cases.

Note that this is the minimum number of traces written to a file, rather than the maximum. It's possible that we could use this PR to also discuss whether that makes sense to users. (I believe in practice the number of written traces will be only a little more than the specified number, and definitely not more than 2 * the specified number, as long as the specified number is greater than 65536 as mentioned above.)

/cc @nodejs/diagnostics

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading