sysmon: Use new stream for commit time metric
The old stream was created as a string type, so we need to use a new
stream for a gauge type.
BUG=chromium:708293
TEST=None
Change-Id: I6e9fcbff06594e3b0607b42cfc30be47bf8a384b
Reviewed-on: https://chromium-review.googlesource.com/468208
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
diff --git a/scripts/sysmon/git_metrics.py b/scripts/sysmon/git_metrics.py
index f3afd6c..145cb97 100644
--- a/scripts/sysmon/git_metrics.py
+++ b/scripts/sysmon/git_metrics.py
@@ -47,8 +47,8 @@
'git/hash',
description='Current Git commit hash.')
- _commit_time_metric = ts_mon.GaugeMetric(
- 'git/commit_time',
+ _timestamp_metric = ts_mon.GaugeMetric(
+ 'git/timestamp',
description='Current Git commit time as seconds since Unix Epoch.')
def __init__(self, gitdir, metric_path):
@@ -61,7 +61,7 @@
"""Collect metrics."""
try:
self._collect_commit_hash_metric()
- self._collect_commit_time_metric()
+ self._collect_timestamp_metric()
except subprocess.CalledProcessError as e:
logger.warning('Error collecting git metrics for %s: %s',
self._gitdir, e)
@@ -71,11 +71,11 @@
logger.debug('Collecting Git hash %r for %r', commit_hash, self._gitdir)
self._commit_hash_metric.set(commit_hash, self._fields)
- def _collect_commit_time_metric(self):
+ def _collect_timestamp_metric(self):
commit_time = self._gitrepo.get_commit_time()
- logger.debug('Collecting Git commit time %r for %r',
+ logger.debug('Collecting Git timestamp %r for %r',
commit_time, self._gitdir)
- self._commit_time_metric.set(commit_time, self._fields)
+ self._timestamp_metric.set(commit_time, self._fields)
_CHROMIUMOS_DIR = os.path.expanduser('~chromeos-test/chromiumos/')