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

Re: [PATCH v3 00/10] trace2: load trace2 settings from system config

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2019, 02:29 UTC
Message-ID
<xmqqv9zkymzd.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<pull.169.v3.git.gitgitgadget@gmail.com>
"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Here is version 3.
> [] It incorporates Ævar's suggestions WRT the format and uniqueness of the
> SID. [] It now reads both system and global config for trace2 settings and
> handles includes as Jonathan suggested.

Following the ISO more closely with Ts and Zs in the format looks like a good idea (i.e. it gives a more familiar-looking result). I have no string opinions on the per-user config or inclusion, but I think it probably is an essential ingredient to give an opt-out escape hatch to make this appear less big-brotherly [*1*].

	Side note *1*: and hence less scary.  An otherwise useful
	mechanism can have an appearance that it can also be misused
	for bad purposes, and at that point, to those with fear, it
	does not matter how useful an application the mechanism has.
	I think "by default you are opting in due to your belonging
	to this organization in the first place (hence we give you
	/etc/gitconfig that lets us collect your usage patterns) but
	you could easily opt-out by overriding in $HOME/.gitconfig"
	strikes a good balance.
> I added a read_very_early_config() function that is similar to 
> read_early_config()but omits repo local, worktree, and -c command line
> settings. This felt like a little bit of a hack, but it made the intent
> clear.

I am not yet judging if the "very early config" itself is a good thing to have (and if it is good, then it is not a "hack" ;-)), but I very much agree that it is a very good change to have a helper that makes the intent clear.

Show 5 quoted lines
>      -+# Now test using system config by using a mocked up config file
>      -+# rather than inheriting "/etc/gitconfig".  Here we do not use
>      -+# GIT_TR2* environment variables.
>      -+
>       +unset GIT_TR2_BRIEF

This does not have to be sane_unset, as we are not aiming for making our tests "set -e" clean. But in tXXXX-*.sh scripts, it may not be a bad idea to stick to sane_unset regardless, as people tend to cut and paste without thinking enough.

Show 26 quoted lines
>      @@ -512,19 +454,28 @@
>       + */
>       +/* clang-format off */
>
>      ++	[TR2_SYSENV_CFG_PARAM]     = { "GIT_TR2_CONFIG_PARAMS",
>      ++				       "trace2.configparams" },
>      ++
>      ++	[TR2_SYSENV_DST_DEBUG]     = { "GIT_TR2_DST_DEBUG",
>      ++				       "trace2.destinationdebug" },
>      ++
>      ++	[TR2_SYSENV_NORMAL]        = { "GIT_TR2",
>      ++				       "trace2.normaltarget" },
>      ++	[TR2_SYSENV_NORMAL_BRIEF]  = { "GIT_TR2_BRIEF",
>      ++				       "trace2.normalbrief" },
>      ++
>      ++	[TR2_SYSENV_EVENT]         = { "GIT_TR2_EVENT",
>      ++				       "trace2.eventtarget" },
>      ++	[TR2_SYSENV_EVENT_BRIEF]   = { "GIT_TR2_EVENT_BRIEF",
>      ++				       "trace2.eventbrief" },
>      ++	[TR2_SYSENV_EVENT_NESTING] = { "GIT_TR2_EVENT_NESTING",
>      ++				       "trace2.eventnesting" },
>      ++
>      ++	[TR2_SYSENV_PERF]          = { "GIT_TR2_PERF",
>      ++				       "trace2.perftarget" },
>      ++	[TR2_SYSENV_PERF_BRIEF]    = { "GIT_TR2_PERF_BRIEF",
>      ++				       "trace2.perfbrief" },

With use of designated initializers, the table got a lot cleaner to read. Is the above "format off" still needed (I am a bit curious how clang-format wants these entries to look like)?

>      ++	if (pid > 999999)
>      ++		strbuf_addf(&tr2sid_buf, "W%06d", (int)(pid % 1000000));
>      ++	else
>      ++		strbuf_addf(&tr2sid_buf, "P%06d", (int)pid);
I do not think it matters too much, but this is kind-of curious.

How would the users of the log utilize the distinction between W and P? Do they discard the ones with W when they care about the exact process that left the trace entries, or something? If it's not a plausibly useful use pattern (and I do not think it is), I wonder if we want to go with only W (i.e. truncated to the lower N digits) entries, if you are shooting for a fixed-width output from this function. If you want less chance of collisions, you obviously could use hexadecimal to gain back a few more bits.

After all, if the application does care the PID, that could be in the log data itself (i.e. an "start" event can say "my pid is blah").

Thanks.  I'll wait until learning what others think.
Previous: Jeff Hostetler via GitGitGadgetNext: Jeff Hostetler
Message 40 of 68 in “trace2: load trace2 settings from system config”
  1. 0/4 trace2: load trace2 settings from system configJeff Hostetler via GitGitGadget, Mar 28, 2019
  2. 1/4 trace2: refactor setting process starting timeJeff Hostetler via GitGitGadget, Mar 28, 2019
  3. 2/4 trace2: add absolute elapsed time to start eventJeff Hostetler via GitGitGadget, Mar 28, 2019
  4. 3/4 trace2: find exec-dir before trace2 initializationJeff Hostetler via GitGitGadget, Mar 28, 2019
  5. 4/4 trace2: use system config for default trace2 settingsJeff Hostetler via GitGitGadget, Mar 28, 2019
  6. Ævar Arnfjörð BjarmasonMar 28, 2019
  7. Jeff HostetlerMar 28, 2019
  8. Josh SteadmonMar 28, 2019
  9. 0/7 trace2: load trace2 settings from system configJeff Hostetler via GitGitGadget, Mar 29, 2019
  10. 2/7 trace2: add absolute elapsed time to start eventJeff Hostetler via GitGitGadget, Mar 29, 2019
  11. 3/7 trace2: find exec-dir before trace2 initializationJeff Hostetler via GitGitGadget, Mar 29, 2019
  12. 5/7 trace2: report peak memory usage of the processJeff Hostetler via GitGitGadget, Mar 29, 2019
  13. Ævar Arnfjörð BjarmasonMar 29, 2019
  14. Jeff HostetlerApr 1, 2019
  15. 6/7 trace2: clarify UTC datetime formattingJeff Hostetler via GitGitGadget, Mar 29, 2019
  16. 4/7 trace2: use system config for default trace2 settingsJeff Hostetler via GitGitGadget, Mar 29, 2019
  17. Josh SteadmonApr 1, 2019
  18. Jeff HostetlerApr 1, 2019
  19. Jonathan NiederApr 3, 2019
  20. Jonathan NiederApr 3, 2019
  21. Jeff HostetlerApr 9, 2019
  22. 7/7 trace2: make SIDs more uniqueJeff Hostetler via GitGitGadget, Mar 29, 2019
  23. Ævar Arnfjörð BjarmasonMar 29, 2019
  24. Jeff HostetlerApr 1, 2019
  25. 1/7 trace2: refactor setting process starting timeJeff Hostetler via GitGitGadget, Mar 29, 2019
  26. Josh SteadmonApr 1, 2019
  27. 00/10 trace2: load trace2 settings from system configJeff Hostetler via GitGitGadget, Apr 11, 2019
  28. 01/10 config: initialize opts structure in repo_read_config()Jeff Hostetler via GitGitGadget, Apr 11, 2019
  29. Jonathan NiederApr 12, 2019
  30. Johannes SchindelinApr 15, 2019
  31. 03/10 trace2: add absolute elapsed time to start eventJeff Hostetler via GitGitGadget, Apr 11, 2019
  32. 05/10 config: add read_very_early_config()Jeff Hostetler via GitGitGadget, Apr 11, 2019
  33. 08/10 trace2: clarify UTC datetime formattingJeff Hostetler via GitGitGadget, Apr 11, 2019
  34. 07/10 trace2: report peak memory usage of the processJeff Hostetler via GitGitGadget, Apr 11, 2019
  35. 10/10 trace2: update docs to describe system/global config settingsJeff Hostetler via GitGitGadget, Apr 11, 2019
  36. 09/10 trace2: make SIDs more uniqueJeff Hostetler via GitGitGadget, Apr 11, 2019
  37. 02/10 trace2: refactor setting process starting timeJeff Hostetler via GitGitGadget, Apr 11, 2019
  38. 06/10 trace2: use system/global config for default trace2 settingsJeff Hostetler via GitGitGadget, Apr 11, 2019
  39. 04/10 trace2: find exec-dir before trace2 initializationJeff Hostetler via GitGitGadget, Apr 11, 2019
  40. Junio C HamanoApr 12, 2019
  41. Jeff HostetlerApr 12, 2019
  42. 00/10 trace2: load trace2 settings from system configJeff Hostetler via GitGitGadget, Apr 15, 2019
  43. 01/10 config: initialize opts structure in repo_read_config()Jeff Hostetler via GitGitGadget, Apr 15, 2019
  44. 02/10 trace2: refactor setting process starting timeJeff Hostetler via GitGitGadget, Apr 15, 2019
  45. 03/10 trace2: add absolute elapsed time to start eventJeff Hostetler via GitGitGadget, Apr 15, 2019
  46. 05/10 config: add read_very_early_config()Jeff Hostetler via GitGitGadget, Apr 15, 2019
  47. 07/10 trace2: report peak memory usage of the processJeff Hostetler via GitGitGadget, Apr 15, 2019
  48. 06/10 trace2: use system/global config for default trace2 settingsJeff Hostetler via GitGitGadget, Apr 15, 2019
  49. SZEDER GáborApr 27, 2019
  50. Jeff HostetlerApr 29, 2019
  51. 10/10 trace2: update docs to describe system/global config settingsJeff Hostetler via GitGitGadget, Apr 15, 2019
  52. 04/10 trace2: find exec-dir before trace2 initializationJeff Hostetler via GitGitGadget, Apr 15, 2019
  53. 09/10 trace2: make SIDs more uniqueJeff Hostetler via GitGitGadget, Apr 15, 2019
  54. 08/10 trace2: clarify UTC datetime formattingJeff Hostetler via GitGitGadget, Apr 15, 2019
  55. 00/11 trace2: load trace2 settings from system configJeff Hostetler via GitGitGadget, Apr 29, 2019
  56. 01/11 config: initialize opts structure in repo_read_config()Jeff Hostetler via GitGitGadget, Apr 29, 2019
  57. 03/11 trace2: add absolute elapsed time to start eventJeff Hostetler via GitGitGadget, Apr 29, 2019
  58. 02/11 trace2: refactor setting process starting timeJeff Hostetler via GitGitGadget, Apr 29, 2019
  59. 07/11 trace2: report peak memory usage of the processJeff Hostetler via GitGitGadget, Apr 29, 2019
  60. 08/11 trace2: clarify UTC datetime formattingJeff Hostetler via GitGitGadget, Apr 29, 2019
  61. 09/11 trace2: make SIDs more uniqueJeff Hostetler via GitGitGadget, Apr 29, 2019
  62. 06/11 trace2: use system/global config for default trace2 settingsJeff Hostetler via GitGitGadget, Apr 29, 2019
  63. 11/11 trace2: fixup access problem on /etc/gitconfig in read_very_early_configJeff Hostetler via GitGitGadget, Apr 29, 2019
  64. 10/11 trace2: update docs to describe system/global config settingsJeff Hostetler via GitGitGadget, Apr 29, 2019
  65. 05/11 config: add read_very_early_config()Jeff Hostetler via GitGitGadget, Apr 29, 2019
  66. 04/11 trace2: find exec-dir before trace2 initializationJeff Hostetler via GitGitGadget, Apr 29, 2019
  67. Jeff HostetlerApr 29, 2019
  68. Junio C HamanoMay 7, 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.