[autotest] Add an option for debugging metrics in lab_inventory.

It's possible to do better for debugging the behavior of the
metrics library if we throw the right options at the setup
function.  So, add an option to make it possible.

BUG=chromium:775199
TEST=Run the command with the option

Change-Id: I16d94161d79fb8ca22ea6aa157341ea536994c4e
Reviewed-on: https://chromium-review.googlesource.com/907182
Reviewed-by: Paul Hobbs <phobbs@google.com>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
diff --git a/site_utils/lab_inventory.py b/site_utils/lab_inventory.py
index 87649e0..fd086e1 100755
--- a/site_utils/lab_inventory.py
+++ b/site_utils/lab_inventory.py
@@ -1290,6 +1290,9 @@
                               'recommendation)'))
     parser.add_argument('--repair-loops', action='store_true',
                         help='Check for devices stuck in repair loops.')
+    parser.add_argument('--debug-metrics', action='store_true',
+                        help='Include debug information about the metrics '
+                             'that would be reported ')
     parser.add_argument('--debug', action='store_true',
                         help='Print e-mail messages on stdout '
                              'without sending them.')
@@ -1360,9 +1363,12 @@
         sys.exit(1)
     _configure_logging(arguments)
     try:
-        if not arguments.debug:
+        if arguments.debug_metrics or not arguments.debug:
+            metrics_file = None if not arguments.debug_metrics else '/dev/null'
             with site_utils.SetupTsMonGlobalState(
-                    'repair_loops', short_lived=True, auto_flush=False):
+                    'repair_loops', short_lived=True,
+                    debug_file=metrics_file,
+                    auto_flush=False):
                 _perform_inventory_reports(arguments)
             metrics.Flush()
         else: