git/trace2
Josh Steadmon 83e57b04e6 trace2: discard new traces if target directory has too many files
trace2 can write files into a target directory. With heavy usage, this
directory can fill up with files, causing difficulty for
trace-processing systems.

This patch adds a config option (trace2.maxFiles) to set a maximum
number of files that trace2 will write to a target directory. The
following behavior is enabled when the maxFiles is set to a positive
integer:
  When trace2 would write a file to a target directory, first check
  whether or not the traces should be discarded. Traces should be
  discarded if:
    * there is a sentinel file declaring that there are too many files
    * OR, the number of files exceeds trace2.maxFiles.
  In the latter case, we create a sentinel file named git-trace2-discard
  to speed up future checks.

The assumption is that a separate trace-processing system is dealing
with the generated traces; once it processes and removes the sentinel
file, it should be safe to generate new trace files again.

The default value for trace2.maxFiles is zero, which disables the file
count check.

The config can also be overridden with a new environment variable:
GIT_TRACE2_MAX_FILES.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-10-05 17:53:51 +09:00
..
tr2_cfg.c trace2: use system/global config for default trace2 settings 2019-04-16 13:37:06 +09:00
tr2_cfg.h
tr2_cmd_name.c trace2: rename environment variables to GIT_TRACE2* 2019-05-28 10:20:34 -07:00
tr2_cmd_name.h
tr2_dst.c trace2: discard new traces if target directory has too many files 2019-10-05 17:53:51 +09:00
tr2_dst.h trace2: use system/global config for default trace2 settings 2019-04-16 13:37:06 +09:00
tr2_sid.c trace2: rename environment variables to GIT_TRACE2* 2019-05-28 10:20:34 -07:00
tr2_sid.h
tr2_sysenv.c trace2: discard new traces if target directory has too many files 2019-10-05 17:53:51 +09:00
tr2_sysenv.h trace2: discard new traces if target directory has too many files 2019-10-05 17:53:51 +09:00
tr2_tbuf.c trace2: make SIDs more unique 2019-04-16 13:37:07 +09:00
tr2_tbuf.h trace2: make SIDs more unique 2019-04-16 13:37:07 +09:00
tr2_tgt.h trace2: add absolute elapsed time to start event 2019-04-16 13:37:06 +09:00
tr2_tgt_event.c trace2: remove dead code in maybe_add_string_va() 2019-08-08 10:39:44 -07:00
tr2_tgt_normal.c trace2: cleanup whitespace in normal format 2019-08-09 10:48:02 -07:00
tr2_tgt_perf.c trace2: cleanup whitespace in perf format 2019-08-09 10:48:02 -07:00
tr2_tls.c Merge branch 'jh/trace2' 2019-05-30 10:50:45 -07:00
tr2_tls.h trace2: refactor setting process starting time 2019-04-16 13:37:06 +09:00