[sysmon] Move literal list out of function

Reduce unnecessary operation of creating throwaway lists that need to
be garbage collected.

BUG=None
TEST=None

Change-Id: I7d5be2293c034a8f5239b51e5ecbf6fa33453f03
Reviewed-on: https://chromium-review.googlesource.com/448807
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 eeccdf5..4145261 100644
--- a/scripts/sysmon/system_metrics.py
+++ b/scripts/sysmon/system_metrics.py
@@ -222,23 +222,24 @@
   _collect_net_io_counters()
 
 
+_net_io_metrics = (
+  (_net_up_metric, 'bytes_sent'),
+  (_net_down_metric, 'bytes_recv'),
+  (_net_err_up_metric, 'errout'),
+  (_net_err_down_metric, 'errin'),
+  (_net_drop_up_metric, 'dropout'),
+  (_net_drop_down_metric, 'dropin'),
+)
+
+
 def _collect_net_io_counters():
   """Collect metrics for network IO counters."""
-  metric_counter_names = [
-      (_net_up_metric, 'bytes_sent'),
-      (_net_down_metric, 'bytes_recv'),
-      (_net_err_up_metric, 'errout'),
-      (_net_err_down_metric, 'errin'),
-      (_net_drop_up_metric, 'dropout'),
-      (_net_drop_down_metric, 'dropin'),
-  ]
-
   nics = psutil.net_io_counters(pernic=True)
   for nic, counters in nics.iteritems():
     if _is_virtual_netif(nic):
       continue
     fields = {'interface': nic}
-    for metric, counter_name in metric_counter_names:
+    for metric, counter_name in _net_io_metrics:
       try:
         metric.set(getattr(counters, counter_name), fields=fields)
       except ts_mon.MonitoringDecreasingValueError as ex: