[sysmon] Merge prodmon features into sysmon
BUG=chromium:655796
TEST=Run sysmon and unit tests
Change-Id: Ibdedd9dd1b5edab7819cbcd99243b3af87ef1b68
Reviewed-on: https://chromium-review.googlesource.com/422422
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/scripts/sysmon/system_metrics.py b/scripts/sysmon/system_metrics.py
index 5757504..c64151b 100644
--- a/scripts/sysmon/system_metrics.py
+++ b/scripts/sysmon/system_metrics.py
@@ -19,6 +19,8 @@
from chromite.lib import cros_logging as logging
from infra_libs import ts_mon
+logger = logging.getLogger(__name__)
+
_cpu_count_metric = ts_mon.GaugeMetric(
'dev/cpu/count',
@@ -239,7 +241,7 @@
# This normally shouldn't happen, but might if the network
# driver module is reloaded, so log an error and continue
# instead of raising an exception.
- logging.warning(str(ex))
+ logger.warning(str(ex))
def get_proc_info():
@@ -252,8 +254,8 @@
elif _is_sysmon(proc):
sysmon_count += 1
total += 1
- logging.debug('autoserv_count: %s', autoserv_count)
- logging.debug('sysmon_count: %s', sysmon_count)
+ logger.debug('autoserv_count: %s', autoserv_count)
+ logger.debug('sysmon_count: %s', sysmon_count)
_autoserv_proc_count_metric.set(autoserv_count)
_sysmon_proc_count_metric.set(sysmon_count)
_proc_count_metric.set(total)