summaryrefslogtreecommitdiffstats
path: root/git_trace2_event_log.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-09-27 10:55:44 -0700
committerRaman Tenneti <rtenneti@google.com>2021-09-27 19:11:14 +0000
commit956f7363d100abe6c1f58b36d7aea59b9e41cd04 (patch)
tree1974f54a33adea2fc321f735ba1efe00c96b0189 /git_trace2_event_log.py
parent6f8c1bf4ff1c8cd210e00f0514eec3864967c8a5 (diff)
downloadgit-repo-956f7363d100abe6c1f58b36d7aea59b9e41cd04.tar.gz
superproject: Log argv parameter of syncstate as 'data-json'.
Fixed: "we need to make a special case for logging the argv; it should probably be a "data-json" event so that we log this directly as an array rather than an encoded string. Tested: $ repo_dev sync Verified event logged for argv is "data-json". $./run_tests Bug: [google internal] b/201102002 Change-Id: I18ccec79c73c8dc931cb8afc472b2361db8aea4c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319055 Reviewed-by: Josh Steadmon <steadmon@google.com> Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
Diffstat (limited to 'git_trace2_event_log.py')
-rw-r--r--git_trace2_event_log.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py
index 92c4cc6b..0d4f23f4 100644
--- a/git_trace2_event_log.py
+++ b/git_trace2_event_log.py
@@ -167,6 +167,10 @@ class EventLog(object):
167 repo_config = {k: v for k, v in config.items() if k.startswith('repo.')} 167 repo_config = {k: v for k, v in config.items() if k.startswith('repo.')}
168 self.LogConfigEvents(repo_config, 'def_param') 168 self.LogConfigEvents(repo_config, 'def_param')
169 169
170 def GetDataEventName(self, key):
171 """Returns the 'data-json' if the key is argv else returns 'data'."""
172 return 'data-json' if key.endswith('sys.argv') else 'data'
173
170 def LogDataConfigEvents(self, config, prefix): 174 def LogDataConfigEvents(self, config, prefix):
171 """Append a 'data' event for each config key/value in |config| to the current log. 175 """Append a 'data' event for each config key/value in |config| to the current log.
172 176
@@ -178,7 +182,7 @@ class EventLog(object):
178 prefix: Prefix for each key that is logged. 182 prefix: Prefix for each key that is logged.
179 """ 183 """
180 for key, value in config.items(): 184 for key, value in config.items():
181 event = self._CreateEventDict('data') 185 event = self._CreateEventDict(self.GetDataEventName(key))
182 event['key'] = f'{prefix}/{key}' 186 event['key'] = f'{prefix}/{key}'
183 event['value'] = value 187 event['value'] = value
184 self._log.append(event) 188 self._log.append(event)