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

Re: [PATCH 4/8] trace: refactor to support multiple env variables

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 24, 2011, 18:25 UTC
Message-ID
<7vsjvd1e9r.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110224142841.GD15477@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> Right now you turn all tracing off and on with GIT_TRACE. To
> support new types of tracing without forcing the user to see
> all of them, we will soon support turning each tracing area
> on with GIT_TRACE_*.
>
> This patch lays the groundwork by providing an interface
> which does not assume GIT_TRACE. However, we still maintain
> the trace_printf interface so that existing callers do not
> need to be refactored.

One thing I found missing in the patch description is a statement of the overall design and expected usage. It appears to me that the design is built around the idea to give each named/namable area to be traceable its own trace output file descriptor, so that different kinds of trace events are sent to different files.

I however expect that majority of "trace only areas A and B" users would want to see logs of events from these two areas in the same stream to see them in the order they happened. Perhaps you are envisioning that these users would use redirection from the command line to send GIT_TRACE_A and GIT_TRACE_B to the same place; that probably needs to be spelled out more explicitly somewhere in the documentation, as that would be a more common thing to do.

I think your [7/8] is kind of strange when viewed in that light. Imagine what would happen if you gave separate GIT_TRACE_* to each packet class, instead of giving them a single umbrella variable GIT_TRACE_PACKET. If the user wants to see them all in a single stream, the same redirection you would use to unify GIT_TRACE_A and GIT_TRACE_B can be used.

Instead, you have packet class prefix in the output so that later the different kinds of packet events can be sifted out from the unified output, even though they are forced to go to the same output stream. In a sense, you have two-tier classification system for traceable events (the top layer that can be separated or merged at the file descriptor level, and the bottom layer that can only be separated by looking at the prefix).

Is this necessarily a good thing (not a rhetorical question)?

To put it another and opposite way, I wonder if it would be better to instead use a single output stream named by GIT_TRACE and add trace event class prefix to the output for classes like SETUP and PACKET (again, not a rhetorical question).

Also instead of wasting environment variable names, it might be a more compact design from the user's point of view if we took a list of trace event classes in a single environment variable, e.g.

	GIT_TRACE_CLASS=setup,packet \
        GIT_TRACE=/tmp/tr \
        git push
I dunno.
Previous: Jeff KingNext: Jeff King
Message 15 of 32 in “refactor trace code”
  1. 0/8 refactor trace codeJeff King, Feb 24, 2011
  2. 1/8 compat: provide a fallback va_copy definitionJeff King, Feb 24, 2011
  3. Erik Faye-LundFeb 24, 2011
  4. compat: fall back on __va_copy if availableJonathan Nieder, Mar 8, 2011
  5. Junio C HamanoMar 8, 2011
  6. Jonathan NiederMar 8, 2011
  7. Jonathan NiederFeb 24, 2011
  8. 2/8 strbuf: add strbuf_addvJeff King, Feb 24, 2011
  9. Christian CouderFeb 24, 2011
  10. Jeff KingFeb 24, 2011
  11. Jonathan NiederFeb 24, 2011
  12. 3/8 trace: add trace_vprintfJeff King, Feb 24, 2011
  13. Jonathan NiederFeb 24, 2011
  14. 4/8 trace: refactor to support multiple env variablesJeff King, Feb 24, 2011
  15. Junio C HamanoFeb 24, 2011
  16. Jeff KingFeb 24, 2011
  17. Junio C HamanoFeb 24, 2011
  18. Jeff KingFeb 24, 2011
  19. Junio C HamanoFeb 24, 2011
  20. Jonathan NiederFeb 24, 2011
  21. 5/8 trace: factor out "do we want to trace" logicJeff King, Feb 24, 2011
  22. Christian CouderFeb 24, 2011
  23. 6/8 trace: add trace_strbufJeff King, Feb 24, 2011
  24. 7/8 add packet tracing debug codeJeff King, Feb 24, 2011
  25. Jonathan NiederFeb 24, 2011
  26. 8/8 trace: give repo_setup trace its own keyJeff King, Feb 24, 2011
  27. Andreas EricssonFeb 24, 2011
  28. Jeff KingFeb 24, 2011
  29. Christian CouderFeb 24, 2011
  30. Jonathan NiederFeb 24, 2011
  31. Nguyen Thai Ngoc DuyFeb 25, 2011
  32. Junio C HamanoFeb 26, 2011

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.