Do not report ts_mon metrics from inside SSP container

ts_mon setup inside the SSP container has been broken for a while but
the cleanup actions add a ~5 second overhead to each test run. Disable
ts_mon inside the container until the root cause is fixed.

BUG=chromium:1054522
TEST=None

Change-Id: Ic8a31d7ec904c001a5138458f44b6567605d659b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2253040
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Jacob Kopczynski <jkop@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/server/autoserv b/server/autoserv
index 3345af0..06d8f87 100755
--- a/server/autoserv
+++ b/server/autoserv
@@ -553,8 +553,14 @@
     auto_start_servod = _CONFIG.get_config_value(
             'AUTOSERV', 'auto_start_servod', type=bool, default=False)
 
-    site_utils.SetupTsMonGlobalState('autoserv', indirect=False,
-                                     short_lived=True)
+    if not utils.is_in_container():
+        # crbug.com/1054522 -- ts_mon setup is broken inside the SSP container
+        # due to a problem in the installed python packages.
+        # Trying to clean up an incorrectly initialized ts_mon state adds a 5
+        # second overhead in process teardown, so avoid setting up ts_mon
+        # entirely inside the SSP container.
+        site_utils.SetupTsMonGlobalState('autoserv', indirect=False,
+                                         short_lived=True)
     try:
         try:
             if repair: