autotest: Min scope to check if DUT pingable only for test

To clean up the scope increase count of ping to 3 per attempt and
collect stat only for tests.

BUG=b:171414073
TEST=run local repair

./server/autoserv -s --host-info-subdir host_info_store -m    chromeos1-row4-rack4-host3 --lab True --local-only-host-info True -R -r /tr/

Change-Id: I04f143f2fe95308207454a348f70ef70acfa19af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2578737
Tested-by: Otabek Kasimov <otabek@google.com>
Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Garry Wang <xianuowang@chromium.org>
Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index effaba3..cd2f2a5 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -357,7 +357,7 @@
                 result_dir=self.get_result_dir())
 
         # TODO(otabek@): remove when b/171414073 closed
-        pingable_before_servo = self.is_up_fast()
+        pingable_before_servo = self.is_up_fast(count=3)
         if pingable_before_servo:
             logging.info('DUT is pingable before init Servo.')
         _servo_host, servo_state = servo_host.create_servo_host(
@@ -377,20 +377,19 @@
 
         # TODO(otabek@): remove when b/171414073 closed
         # Introduced to collect cases when servo made DUT not sshable
-        pingable_after_servo = self.is_up_fast()
+        pingable_after_servo = self.is_up_fast(count=3)
         if pingable_after_servo:
             logging.info('DUT is pingable after init Servo.')
         elif pingable_before_servo:
             logging.info('DUT was pingable before init Servo but not now')
-            board = ''
-            info = self.host_info_store.get()
-            if info:
-                board = info.board
-            metrics.Counter('chromeos/autotest/dut_ping_servo_init').increment(
-                    fields={
-                            'host': self.hostname,
-                            'board': board,
-                    })
+            if servo_args and self._servo_host and self._servo_host.hostname:
+                # collect stats only for tests.
+                dut_ping_servo_init_data = {
+                        'host': self.hostname,
+                        'servo_host': self._servo_host.hostname,
+                }
+                metrics.Counter('chromeos/autotest/dut_ping_servo_init2'
+                                ).increment(fields=dut_ping_servo_init_data)
 
         # TODO(waihong): Do the simplication on Chameleon too.
         self._chameleon_host = chameleon_host.create_chameleon_host(