mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
Add way to track env variables.
Bug:b/265929888 Change-Id: Ibf24e9aae7bff1d9af36c15fc7f9bdad9dbba526 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4209320 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Joanna Wang <jojwang@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -32,6 +32,9 @@ UPLOAD_SCRIPT = os.path.join(DEPOT_TOOLS, 'upload_metrics.py')
|
||||
|
||||
DEFAULT_COUNTDOWN = 10
|
||||
|
||||
# TODO(b/265929888): Remove this variable when dogfood is over.
|
||||
DEPOT_TOOLS_ENV = ['DOGFOOD_STACKED_CHANGES']
|
||||
|
||||
INVALID_CONFIG_WARNING = (
|
||||
'WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will '
|
||||
'be created.'
|
||||
@@ -225,6 +228,12 @@ 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))
|
||||
try:
|
||||
start = time.time()
|
||||
result = func(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user