git-cl: Report git push information to metrics collection.
Bug: 897394
Change-Id: I52a31bb4840b5de89b96545a3e7544c6708f148f
Reviewed-on: https://chromium-review.googlesource.com/c/1312240
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/metrics_utils.py b/metrics_utils.py
index 2be13be..883c694 100644
--- a/metrics_utils.py
+++ b/metrics_utils.py
@@ -142,6 +142,23 @@
r'git version (\d)\.(\d{0,2})\.(\d{0,2})'
)
+KNOWN_SUBCOMMAND_ARGS = {
+ 'cc',
+ 'hashtag',
+ 'l=Auto-Submit+1',
+ 'l=Commit-Queue+1',
+ 'l=Commit-Queue+2',
+ 'label',
+ 'm',
+ 'notify=ALL',
+ 'notify=NONE',
+ 'private',
+ 'r',
+ 'ready',
+ 'topic',
+ 'wip'
+}
+
def get_python_version():
"""Return the python version in the major.minor.micro format."""
@@ -178,6 +195,19 @@
return int(duration) >> 19
+def extract_known_subcommand_args(args):
+ """Extract the known arguments from the passed list of args."""
+ known_args = []
+ for arg in args:
+ if arg in KNOWN_SUBCOMMAND_ARGS:
+ known_args.append(arg)
+ else:
+ arg = arg.split('=')[0]
+ if arg in KNOWN_SUBCOMMAND_ARGS:
+ known_args.append(arg)
+ return known_args
+
+
def extract_http_metrics(request_uri, method, status, response_time):
"""Extract metrics from the request URI.