Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1972)

Unified Diff: infra_libs/ts_mon/common/metrics.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add noncululativedistribution metric to ts_mon imports Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra_libs/ts_mon/common/http_metrics.py ('k') | infra_libs/ts_mon/common/standard_metrics.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « infra_libs/ts_mon/common/http_metrics.py ('k') | infra_libs/ts_mon/common/standard_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698