From 5ed21de943cd7c9e877f63b099609f71171533ae Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Thu, 2 Feb 2023 21:17:41 +0000 Subject: [PATCH] Change env_variables to repeated metric. Bug: b/265929888 Change-Id: I7787e053ca0785801817e4916d9b25fa2ff0e8d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4219772 Auto-Submit: Joanna Wang Reviewed-by: Gavin Mak Commit-Queue: Gavin Mak --- metrics.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/metrics.py b/metrics.py index 9d1b585a8..5d3db6921 100644 --- a/metrics.py +++ b/metrics.py @@ -228,12 +228,13 @@ class MetricsCollector(object): self._collecting_metrics = True self.add('metrics_version', metrics_utils.CURRENT_VERSION) self.add('command', command_name) - environment_variables = [ - '%s=%s' % (env, os.environ.get(env)) for env in DEPOT_TOOLS_ENV - if env in os.environ - ] - if environment_variables: - self.add('env_variables', ','.join(environment_variables)) + for env in DEPOT_TOOLS_ENV: + if env in os.environ: + self.add_repeated('env_variables', { + 'name': env, + 'value': os.environ.get(env) + }) + try: start = time.time() result = func(*args, **kwargs)