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

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

Issue 1797103003: gae_ts_mon: instrument Cloud Endpoint methods (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Reduced test flakiness Created 4 years, 9 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/test/http_metrics_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/common/interface.py
diff --git a/infra_libs/ts_mon/common/interface.py b/infra_libs/ts_mon/common/interface.py
index 40581a5ab12d03d2259fbf38904f622d6e1a1123..73d6de2024e4d60930e77af1b7a6d5fd1a4a5276 100644
--- a/infra_libs/ts_mon/common/interface.py
+++ b/infra_libs/ts_mon/common/interface.py
@@ -78,6 +78,11 @@ class State(object):
# Cached time of the last flush. Useful mostly in AppEngine apps.
self.last_flushed = datetime.datetime.utcfromtimestamp(0)
+ def reset_for_unittest(self):
+ self.metrics = {}
+ self.last_flushed = datetime.datetime.utcfromtimestamp(0)
+ self.store.reset_for_unittest()
+
state = State()
@@ -132,8 +137,10 @@ def close():
state.flush_thread.stop()
-def reset_for_unittest():
- state.store.reset_for_unittest()
+def reset_for_unittest(disable=False):
+ state.reset_for_unittest()
+ if disable:
+ state.flush_enabled_fn = lambda: False
class _FlushThread(threading.Thread):
« no previous file with comments | « infra_libs/ts_mon/common/http_metrics.py ('k') | infra_libs/ts_mon/common/test/http_metrics_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698