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

Unified Diff: infra_libs/ts_mon/interface.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/helpers.py ('k') | infra_libs/ts_mon/metrics.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/interface.py
diff --git a/infra_libs/ts_mon/interface.py b/infra_libs/ts_mon/interface.py
index e24bf14d120309f21c77e967f35908a3c5d31741..f5af177b5ae6d93a27341a91b04615a269b4fbb1 100644
--- a/infra_libs/ts_mon/interface.py
+++ b/infra_libs/ts_mon/interface.py
@@ -39,7 +39,7 @@ import time
from monacq.proto import metrics_pb2
-from infra_libs.ts_mon import errors
+from infra_libs.ts_mon.common import errors
# The maximum number of MetricsData messages to include in each HTTP request.
# MetricsCollections larger than this will be split into multiple requests.
@@ -111,19 +111,20 @@ def flush():
def register(metric):
"""Adds the metric to the list of metrics sent by flush().
- This is called automatically by Metric's constructor - you don't need to call
- it manually.
+ This is called automatically by Metric's constructor.
"""
# If someone is registering the same metric object twice, that's okay, but
# registering two different metric objects with the same metric name is not.
- if metric in state.metrics:
- return
+ for m in state.metrics:
+ if metric == m:
+ state.metrics.remove(m)
+ state.metrics.add(metric)
+ return
if any([metric._name == m._name for m in state.metrics]):
raise errors.MonitoringDuplicateRegistrationError(metric._name)
state.metrics.add(metric)
-
def unregister(metric):
"""Removes the metric from the list of metrics sent by flush()."""
state.metrics.remove(metric)
« no previous file with comments | « infra_libs/ts_mon/helpers.py ('k') | infra_libs/ts_mon/metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698