graphite: Separate out configuration from the statsd classes.
The new version of the statsd classes should be created using an instance of
the new Statsd class which sets up some defaults without having to specify
them over and over. This makes it essentially compatible with the existing
usage in autotest, but will allow chromite to configure things differently and
avoid having side effects from importing the module or global state.
BUG=chromium:446291
TEST=Ran unit tests, ran stats_es_functionaltest.py, ran the
stats_mock_unittest, ran a butterfly-paladin tryjob with --hwtest, testing by
fdeng.
DEPLOY=apache,scheduler,host-scheduler
Change-Id: I1071813db197c0e5e035b4d8db615030386f1c1c
Reviewed-on: https://chromium-review.googlesource.com/246428
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/site_utils/run_suite.py b/site_utils/run_suite.py
index b275720..302bde9 100755
--- a/site_utils/run_suite.py
+++ b/site_utils/run_suite.py
@@ -48,7 +48,7 @@
from autotest_lib.client.common_lib import global_config, enum
from autotest_lib.client.common_lib import priorities
from autotest_lib.client.common_lib import time_utils
-from autotest_lib.client.common_lib.cros.graphite import stats
+from autotest_lib.client.common_lib.cros.graphite import autotest_stats
from autotest_lib.client.common_lib.cros import retry
from autotest_lib.frontend.afe.json_rpc import proxy
from autotest_lib.server import utils
@@ -458,25 +458,25 @@
# value the member artifact_end_time is set to None.
if self.download_start_time:
if self.payload_end_time:
- stats.Timer(data_key).send('payload_download_time',
- (self.payload_end_time -
- self.download_start_time).total_seconds())
+ autotest_stats.Timer(data_key).send('payload_download_time',
+ (self.payload_end_time -
+ self.download_start_time).total_seconds())
if self.artifact_end_time:
- stats.Timer(data_key).send('artifact_download_time',
- (self.artifact_end_time -
- self.download_start_time).total_seconds())
+ autotest_stats.Timer(data_key).send('artifact_download_time',
+ (self.artifact_end_time -
+ self.download_start_time).total_seconds())
if self.tests_end_time:
if self.suite_start_time:
- stats.Timer(data_key).send('suite_run_time',
- (self.tests_end_time -
- self.suite_start_time).total_seconds())
+ autotest_stats.Timer(data_key).send('suite_run_time',
+ (self.tests_end_time -
+ self.suite_start_time).total_seconds())
if self.tests_start_time:
- stats.Timer(data_key).send('tests_run_time',
- (self.tests_end_time -
- self.tests_start_time).total_seconds())
+ autotest_stats.Timer(data_key).send('tests_run_time',
+ (self.tests_end_time -
+ self.tests_start_time).total_seconds())
_DEFAULT_AUTOTEST_INSTANCE = CONFIG.get_config_value(
@@ -1381,7 +1381,8 @@
logging.info('Will return from run_suite with status: %s',
RETURN_CODES.get_string(code))
- stats.Counter('run_suite.%s' % RETURN_CODES.get_string(code)).increment()
+ autotest_stats.Counter('run_suite.%s' %
+ RETURN_CODES.get_string(code)).increment()
return code