mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
gclient: Start reporting metrics.
Bug: 832386 Change-Id: I6d1167802f077bcd67bf004ccc417661d8fff3c7 Reviewed-on: https://chromium-review.googlesource.com/1135903 Reviewed-by: Aaron Gable <agable@chromium.org> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This commit is contained in:
@@ -108,12 +108,19 @@ class MetricsCollector(object):
|
||||
self._metrics_lock = threading.Lock()
|
||||
self._reported_metrics = {}
|
||||
self._config = _Config()
|
||||
self._collecting_metrics = False
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return self._config
|
||||
|
||||
@property
|
||||
def collecting_metrics(self):
|
||||
return self._collecting_metrics
|
||||
|
||||
def add(self, name, value):
|
||||
if not self.collecting_metrics:
|
||||
return
|
||||
with self._metrics_lock:
|
||||
self._reported_metrics[name] = value
|
||||
|
||||
@@ -187,6 +194,7 @@ class MetricsCollector(object):
|
||||
@functools.wraps(func)
|
||||
def _inner(*args, **kwargs):
|
||||
self._collect_metrics(func, command_name, *args, **kwargs)
|
||||
self._collecting_metrics = True
|
||||
return _inner
|
||||
return _decorator
|
||||
|
||||
|
||||
Reference in New Issue
Block a user