| Index: infra_libs/ts_mon/common/metrics.py
|
| diff --git a/infra_libs/ts_mon/metrics.py b/infra_libs/ts_mon/common/metrics.py
|
| similarity index 96%
|
| rename from infra_libs/ts_mon/metrics.py
|
| rename to infra_libs/ts_mon/common/metrics.py
|
| index fa986e6e115441c8eaaf97f57c1577658d5e0337..446ad5f112142f6e4cf6c034f66c4a220fe94445 100644
|
| --- a/infra_libs/ts_mon/metrics.py
|
| +++ b/infra_libs/ts_mon/common/metrics.py
|
| @@ -9,11 +9,16 @@ import copy
|
| import threading
|
| import time
|
|
|
| -from monacq.proto import metrics_pb2
|
| -
|
| -from infra_libs.ts_mon import distribution
|
| -from infra_libs.ts_mon import errors
|
| -from infra_libs.ts_mon import interface
|
| +try:
|
| + from infra_libs.ts_mon import interface
|
| + from infra_libs.ts_mon.common import distribution
|
| + from infra_libs.ts_mon.common import errors
|
| + from monacq.proto import metrics_pb2
|
| +except ImportError: # pragma: no cover
|
| + import interface
|
| + from common import distribution
|
| + from common import errors
|
| + from monacq.proto import metrics_pb2
|
|
|
|
|
| MICROSECONDS_PER_SECOND = 1000000
|
| @@ -69,6 +74,14 @@ class Metric(object):
|
|
|
| interface.register(self)
|
|
|
| +
|
| + def __eq__(self, other):
|
| + name = self._name == other._name
|
| + target = self._target == other._target
|
| + field = self._fields == other._fields
|
| + instance_type = type(self) == type(other)
|
| + return name and target and field and instance_type
|
| +
|
| def unregister(self):
|
| interface.unregister(self)
|
|
|
|
|