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

Re: [PATCH 0/8] WIP: trace2: a new trace facility

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Jan 15, 2019, 17:03 UTC
Message-ID
<5df8db4b-c772-c202-5f58-58e9498f6bc0@jeffhostetler.com>
In-Reply-To
<20190115010528.GJ162110@google.com>
On 1/14/2019 8:05 PM, Jonathan Nieder wrote:
Show 13 quoted lines
> Hi,
> 
> Jeff Hostetler wrote:
> 
>> This patch series contains a new trace2 facility that hopefully addresses
>> the recent trace- and structured-logging-related discussions. The intent is
>> to eventually replace the existing trace_ routines (or to route them to the
>> new trace2_ routines) as time permits.
> 
> I've been running with these patches since last October.  A few
> thoughts:
> 
> I like the API.

Great, thanks. Hopefully you're getting some good/actionable data from it.

> The logs are a bit noisy and especially wide.  For my use, the
> function name is not too important since we can get that from the file
> and line number.  Should we have a way to omit some fields, or is that
> for post-processing?
Yes, the events are a little wide and noisy, at least in this draft.

Part of this is to flesh out the trace2 API (which should be relatively fixed) and make sure we have enough event types to emit useful information. This is independent of some of the detail events (like region/data events within status or index reading/writing). Some of those detail events might be kept if they're useful or temporary demonstration events or events you could include in a private build for a limited period of time. So some of the noise might be those demonstration events (stuff that you'd want for testing in a perf view, but not need archived, for example).

Also, for the events that have a "category" field, I'd eventually like to have a filter setting to include/omit them. This is something like the GIT_TRACE_<name> feature we currently have, but limited to always writing to the same file. I had this in an earlier version, but haven't brought it over yet.

And yes, I have a post-processing step that filters fields and generates a summary record for each process instance. My previous draft tried to do that summary inside the git.exe process and it was suggested that we move that out, so this version emits the raw data as it occurs and I get the summary after the fact. This has turned out nicely, even if the Trace2 stream is a little noisy.

There are some fields that I'd like to omit from my JSON stream that I'm not using in my summary, such as the filename and line number. These got carried along since the PERF view needed them. I think they make sense in the PERF view, but not so much in the EVENT view. I'm filtering them out in my post-processing, but I think we could just omit them.

> We don't find the JSON easy to parse and would prefer a binary format.

I'm going to have to push back a little on this one. JSON is easy to process in PERL, C#, various databases, and etc. Processing a non-text format in bash is just asking for pain and suffering.

Can you elaborate on the problems you're having with JSON?

When you say "binary" what kind of binary do you mean? Is this BSON? Or are you suggesting protocol buffers? If the latter, is there a C binding for that? (Every example I've seen talks about C++.)

In my gvfs-trace2-v4 branch, I've refactored the code and now have a vtable-like mechanism that allows multiple Trace2 "targets" to be defined. See trace2/tr2_tgt_perf.c vs trace2/tr2_tgt_events.c. The former generates the GIT_TR2_PERF view and the latter generates the JSON event view.

You could add a self-contained target vtable that generates a binary view if you wanted. (Just let it key off of a different GIT_TR2_ environment variable.)

Show 22 quoted lines
> When I apply the patches, Git complains about whitespace problems
> (trailing whitespace, etc).
> 
> Aside from that kind of easily correctible issue (trailing
> whitespace), I'd be in favor of taking these patches pretty much as-is
> and making improvements in tree.  Any objections to that, or do you
> have other thoughts on where this should go?
> 
> If that sounds reasonable to you, I can send a clean version of these
> based against current "master".  If I understand correctly, then
> 
>   https://github.com/jeffhostetler/git
> 
> branch
> 
>   gvfs-trace2-v4
> 
> contains some improvements, so as a next step I'd try to extract those
> as incremental patches on top.  What do you think?
> 
> Thanks,
> Jonathan

The gvfs-trace2-v4 version has lots of improvements over the version I last posted on the mailing list. We should go with it.

I'm not surprised that there are merge conflicts, since mine is based upon the recent GVFS release and has some gvfs-specific commits in it.

Let me rebase that branch onto the upstream/master and clean up the mess and send out another patch set.

Hopefully, I can get that out tomorrow.
Jeff
Previous: Jonathan Nieder
Message 26 of 26 in “WIP: trace2: a new trace facility”
  1. 0/8 WIP: trace2: a new trace facilityJeff Hostetler via GitGitGadget, Aug 31, 2018
  2. 2/8 trace2: add trace2 to mainJeff Hostetler via GitGitGadget, Aug 31, 2018
  3. 1/8 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Aug 31, 2018
  4. Derrick StoleeAug 31, 2018
  5. Stefan BellerSep 4, 2018
  6. Junio C HamanoSep 4, 2018
  7. Jeff HostetlerSep 5, 2018
  8. Jeff HostetlerSep 5, 2018
  9. 4/8 trace2: demonstrate trace2 child process classificationJeff Hostetler via GitGitGadget, Aug 31, 2018
  10. 5/8 trace2: demonstrate instrumenting do_read_indexJeff Hostetler via GitGitGadget, Aug 31, 2018
  11. 3/8 trace2: demonstrate trace2 regions in wt-statusJeff Hostetler via GitGitGadget, Aug 31, 2018
  12. 7/8 trace2: demonstrate setting sub-command parameter in checkoutJeff Hostetler via GitGitGadget, Aug 31, 2018
  13. 8/8 trace2: demonstrate use of regions in read_directory_recursiveJeff Hostetler via GitGitGadget, Aug 31, 2018
  14. 6/8 trace2: demonstrate instrumenting threaded preload_indexJeff Hostetler via GitGitGadget, Aug 31, 2018
  15. Derrick StoleeAug 31, 2018
  16. 0/6 Use trace2 in commit-reachDerrick Stolee, Sep 6, 2018
  17. 1/6 commit-reach: add trace2 telemetry and walk countDerrick Stolee, Sep 6, 2018
  18. 3/6 commit-reach: use trace2 in can_all_from_reachDerrick Stolee, Sep 6, 2018
  19. 2/6 comit-reach: use trace2 for commit_contains_tag_algoDerrick Stolee, Sep 6, 2018
  20. 4/6 test-tool: start trace2 environmentDerrick Stolee, Sep 6, 2018
  21. 5/6 test-lib: add run_and_check_trace2Derrick Stolee, Sep 6, 2018
  22. 6/6 commit-reach: fix first-parent heuristicDerrick Stolee, Sep 6, 2018
  23. Jonathan NiederOct 11, 2018
  24. Derrick StoleeOct 11, 2018
  25. Jonathan NiederJan 15, 2019
  26. Jeff HostetlerJan 15, 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.