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/scheduler/postjob_task.py b/scheduler/postjob_task.py
index de42bea..8c7c204 100644
--- a/scheduler/postjob_task.py
+++ b/scheduler/postjob_task.py
@@ -10,7 +10,7 @@
 
 import os
 
-from autotest_lib.client.common_lib.cros.graphite import stats
+from autotest_lib.client.common_lib.cros.graphite import autotest_stats
 from autotest_lib.frontend.afe import models, model_attributes
 from autotest_lib.scheduler import agent_task, drones, drone_manager
 from autotest_lib.scheduler import email_manager, pidfile_monitor
@@ -122,15 +122,17 @@
     @classmethod
     def _increment_running_processes(cls):
         cls._num_running_processes += 1
-        stats.Gauge('scheduler').send('%s.num_running_processes' % cls.__name__,
-                                      cls._num_running_processes)
+        autotest_stats.Gauge('scheduler').send(
+                '%s.num_running_processes' % cls.__name__,
+                cls._num_running_processes)
 
 
     @classmethod
     def _decrement_running_processes(cls):
         cls._num_running_processes -= 1
-        stats.Gauge('scheduler').send('%s.num_running_processes' % cls.__name__,
-                                      cls._num_running_processes)
+        autotest_stats.Gauge('scheduler').send(
+                '%s.num_running_processes' % cls.__name__,
+                cls._num_running_processes)
 
 
     @classmethod