git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v7 02/15] trace2: create new combined trace facility

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
May 10, 2019, 17:28 UTC
Message-ID
<20190510172824.GR14763@szeder.dev>
In-Reply-To
<90e4e6af9300751fd2e7e98601ed0e60ca048e05.1550874298.git.gitgitgadget@gmail.com>
On Fri, Feb 22, 2019 at 02:25:01PM -0800, Jeff Hostetler via GitGitGadget wrote:
Show 25 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com>
> 
> Create a new unified tracing facility for git.  The eventual intent is to
> replace the current trace_printf* and trace_performance* routines with a
> unified set of git_trace2* routines.
> 
> In addition to the usual printf-style API, trace2 provides higer-level
> event verbs with fixed-fields allowing structured data to be written.
> This makes post-processing and analysis easier for external tools.
> 
> Trace2 defines 3 output targets.  These are set using the environment
> variables "GIT_TR2", "GIT_TR2_PERF", and "GIT_TR2_EVENT".  These may be
> set to "1" or to an absolute pathname (just like the current GIT_TRACE).
> 
> * GIT_TR2 is intended to be a replacement for GIT_TRACE and logs command
>   summary data.
> 
> * GIT_TR2_PERF is intended as a replacement for GIT_TRACE_PERFORMANCE.
>   It extends the output with columns for the command process, thread,
>   repo, absolute and relative elapsed times.  It reports events for
>   child process start/stop, thread start/stop, and per-thread function
>   nesting.
> 
> * GIT_TR2_EVENT is a new structured format. It writes event data as a
>   series of JSON records.

Please document these new environment variables in 'Documentation/git.txt', where the other environment variables, including GIT_TRACE_*, are already documented.

While doing so, please note that the description about the possible values of these variables and of GIT_TRACE above is incomplete, because it's not just "1" or an absolute pathname. Quoting the description of GIT_TRACE:

  If this variable is set to "1", "2" or "true" (comparison is case
  insensitive), trace messages will be printed to stderr.
  
  If the variable is set to an integer value greater than 2 and lower
  than 10 (strictly) then Git will interpret this value as an open
  file descriptor and will try to write the trace messages into this
  file descriptor.

The way I see it in tr2_dst_get_trace_fd() below, this applies to GIT_TRACE2* as well, and it even offers the possibility to specify a Unix Domain Socket, too.

And sorry for barging in with a big bucket of paint this late, but, really... why GIT_TR2 instead of GIT_TRACE2?

Show 41 quoted lines
> +int tr2_dst_get_trace_fd(struct tr2_dst *dst)
> +{
> +	const char *tgt_value;
> +
> +	/* don't open twice */
> +	if (dst->initialized)
> +		return dst->fd;
> +
> +	dst->initialized = 1;
> +
> +	tgt_value = getenv(dst->env_var_name);
> +
> +	if (!tgt_value || !strcmp(tgt_value, "") || !strcmp(tgt_value, "0") ||
> +	    !strcasecmp(tgt_value, "false")) {
> +		dst->fd = 0;
> +		return dst->fd;
> +	}
> +
> +	if (!strcmp(tgt_value, "1") || !strcasecmp(tgt_value, "true")) {
> +		dst->fd = STDERR_FILENO;
> +		return dst->fd;
> +	}
> +
> +	if (strlen(tgt_value) == 1 && isdigit(*tgt_value)) {
> +		dst->fd = atoi(tgt_value);
> +		return dst->fd;
> +	}
> +
> +	if (is_absolute_path(tgt_value))
> +		return tr2_dst_try_path(dst, tgt_value);
> +
> +#ifndef NO_UNIX_SOCKETS
> +	if (starts_with(tgt_value, PREFIX_AF_UNIX))
> +		return tr2_dst_try_unix_domain_socket(dst, tgt_value);
> +#endif
> +
> +	/* Always warn about malformed values. */
> +	tr2_dst_malformed_warning(dst, tgt_value);
> +	tr2_dst_trace_disable(dst);
> +	return 0;
> +}
Previous: Jeff Hostetler via GitGitGadgetNext: Derrick Stolee
Message 144 of 154 in “Trace2 tracing facility”
  1. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 22, 2019
  2. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 22, 2019
  3. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 22, 2019
  4. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  5. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  6. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  7. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 22, 2019
  8. SZEDER GáborJan 25, 2019
  9. Junio C HamanoJan 25, 2019
  10. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 22, 2019
  11. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 22, 2019
  12. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 22, 2019
  13. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 22, 2019
  14. Derrick StoleeJan 23, 2019
  15. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 22, 2019
  16. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 22, 2019
  17. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  18. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 22, 2019
  19. Junio C HamanoJan 23, 2019
  20. Jeff HostetlerJan 25, 2019
  21. SZEDER GáborJan 25, 2019
  22. Josh SteadmonJan 25, 2019
  23. Junio C HamanoJan 22, 2019
  24. Josh SteadmonJan 25, 2019
  25. Jeff HostetlerJan 30, 2019
  26. Jeff HostetlerJan 28, 2019
  27. Junio C HamanoJan 28, 2019
  28. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 28, 2019
  29. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 28, 2019
  30. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 28, 2019
  31. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  32. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  33. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  34. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 28, 2019
  35. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 28, 2019
  36. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 28, 2019
  37. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 28, 2019
  38. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 28, 2019
  39. Junio C HamanoJan 28, 2019
  40. Jeff HostetlerJan 29, 2019
  41. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 28, 2019
  42. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 28, 2019
  43. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  44. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 28, 2019
  45. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  46. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 30, 2019
  47. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 30, 2019
  48. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 30, 2019
  49. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  50. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  51. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 30, 2019
  52. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 30, 2019
  53. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  54. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  55. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  56. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 30, 2019
  57. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  58. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 30, 2019
  59. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  60. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  61. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 30, 2019
  62. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 30, 2019
  63. SZEDER GáborJan 31, 2019
  64. Junio C HamanoJan 31, 2019
  65. Jeff HostetlerFeb 1, 2019
  66. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  67. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  68. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  69. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 30, 2019
  70. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 30, 2019
  71. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  72. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  73. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  74. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  75. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 30, 2019
  76. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 30, 2019
  77. SZEDER GáborJan 31, 2019
  78. Jeff HostetlerFeb 1, 2019
  79. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 30, 2019
  80. SZEDER GáborJan 31, 2019
  81. Jeff HostetlerJan 31, 2019
  82. Junio C HamanoJan 31, 2019
  83. Junio C HamanoJan 31, 2019
  84. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 1, 2019
  85. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 1, 2019
  86. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 1, 2019
  87. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 1, 2019
  88. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  89. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  90. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 1, 2019
  91. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 1, 2019
  92. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 1, 2019
  93. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 1, 2019
  94. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 1, 2019
  95. Ævar Arnfjörð BjarmasonFeb 13, 2019
  96. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 1, 2019
  97. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 1, 2019
  98. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 1, 2019
  99. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  100. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  101. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 6, 2019
  102. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 6, 2019
  103. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 6, 2019
  104. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  105. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  106. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  107. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 6, 2019
  108. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 6, 2019
  109. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 6, 2019
  110. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 6, 2019
  111. Ævar Arnfjörð BjarmasonFeb 15, 2019
  112. Jeff HostetlerFeb 15, 2019
  113. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 6, 2019
  114. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 6, 2019
  115. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 6, 2019
  116. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  117. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 6, 2019
  118. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 6, 2019
  119. Ævar Arnfjörð BjarmasonFeb 14, 2019
  120. Jeff HostetlerFeb 15, 2019
  121. Ævar Arnfjörð BjarmasonMar 17, 2019
  122. Johannes SchindelinMar 21, 2019
  123. Ævar Arnfjörð BjarmasonMar 21, 2019
  124. Johannes SchindelinMar 22, 2019
  125. Jeff HostetlerMar 22, 2019
  126. Ævar Arnfjörð BjarmasonMar 22, 2019
  127. Jeff HostetlerMar 22, 2019
  128. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 22, 2019
  129. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 22, 2019
  130. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 22, 2019
  131. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  132. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  133. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 22, 2019
  134. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 22, 2019
  135. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 22, 2019
  136. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 22, 2019
  137. trace2: fix up a missing "leave" entry pointÆvar Arnfjörð Bjarmason, May 10, 2019
  138. Derrick StoleeMay 10, 2019
  139. Jeff HostetlerMay 20, 2019
  140. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 22, 2019
  141. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 22, 2019
  142. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 22, 2019
  143. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 22, 2019
  144. SZEDER GáborMay 10, 2019
  145. Derrick StoleeMay 10, 2019
  146. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  147. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  148. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 22, 2019
  149. SZEDER GáborJan 31, 2019
  150. Jeff HostetlerJan 31, 2019
  151. Junio C HamanoJan 31, 2019
  152. Jeff HostetlerJan 31, 2019
  153. Jeff HostetlerJan 31, 2019
  154. Junio C HamanoJan 31, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.