summaryrefslogtreecommitdiffstats
path: root/git_trace2_event_log_base.py
diff options
context:
space:
mode:
authorJosip Sokcevic <sokcevic@google.com>2024-11-22 00:02:40 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-11-22 18:39:41 +0000
commitfafd1ec23e8001dc7bdf87f2aa1f59051e33224d (patch)
tree4fb04d40f9f0c389cf7574228f7390653698df78 /git_trace2_event_log_base.py
parentb1613d741e47d4f2a1d4c184daec73c110425385 (diff)
downloadgit-repo-fafd1ec23e8001dc7bdf87f2aa1f59051e33224d.tar.gz
Fix event log command event hierarchy.
command should be cmd_name, to match what git is emitting. This also fixes arguments, so that only relevant arguments are passed instead of the entire sys.args, which will contain wrapper information Change-Id: Id436accfff511292ec2c56798fffb2306dda38fc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/443741 Commit-Queue: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com>
Diffstat (limited to 'git_trace2_event_log_base.py')
-rw-r--r--git_trace2_event_log_base.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/git_trace2_event_log_base.py b/git_trace2_event_log_base.py
index 2f1aac76..56db7a8f 100644
--- a/git_trace2_event_log_base.py
+++ b/git_trace2_event_log_base.py
@@ -130,10 +130,10 @@ class BaseEventLog:
130 "time": datetime.datetime.now(datetime.timezone.utc).isoformat(), 130 "time": datetime.datetime.now(datetime.timezone.utc).isoformat(),
131 } 131 }
132 132
133 def StartEvent(self): 133 def StartEvent(self, argv):
134 """Append a 'start' event to the current log.""" 134 """Append a 'start' event to the current log."""
135 start_event = self._CreateEventDict("start") 135 start_event = self._CreateEventDict("start")
136 start_event["argv"] = sys.argv 136 start_event["argv"] = argv
137 self._log.append(start_event) 137 self._log.append(start_event)
138 138
139 def ExitEvent(self, result): 139 def ExitEvent(self, result):
@@ -159,9 +159,11 @@ class BaseEventLog:
159 name: Name of the primary command (ex: repo, git) 159 name: Name of the primary command (ex: repo, git)
160 subcommands: List of the sub-commands (ex: version, init, sync) 160 subcommands: List of the sub-commands (ex: version, init, sync)
161 """ 161 """
162 command_event = self._CreateEventDict("command") 162 command_event = self._CreateEventDict("cmd_name")
163 name = f"{name}-"
164 name += "-".join(subcommands)
163 command_event["name"] = name 165 command_event["name"] = name
164 command_event["subcommands"] = subcommands 166 command_event["hierarchy"] = name
165 self._log.append(command_event) 167 self._log.append(command_event)
166 168
167 def LogConfigEvents(self, config, event_dict_name): 169 def LogConfigEvents(self, config, event_dict_name):