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

Unified Diff: appengine/third_party/gae_ts_mon/config.py

Issue 2991803002: Update infra_libs to 1.1.15 / 0b44aba87c1c6538439df6d24a409870810747ab (Closed)
Patch Set: fix Created 3 years, 5 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 | « appengine/third_party/gae_ts_mon/__init__.py ('k') | client/third_party/infra_libs/README.swarming » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/third_party/gae_ts_mon/config.py
diff --git a/appengine/third_party/gae_ts_mon/config.py b/appengine/third_party/gae_ts_mon/config.py
index 2bd678dc816558c3266aa279566421f884892de7..e750fff3c4ea9afabf8d988d52d7a9c7743878f8 100644
--- a/appengine/third_party/gae_ts_mon/config.py
+++ b/appengine/third_party/gae_ts_mon/config.py
@@ -80,7 +80,6 @@ def _flush_metrics(time_now):
# ts_mon is not configured.
return False
- logging.info('ts_mon: fetching TSMonInstance entity')
datetime_now = datetime.datetime.utcfromtimestamp(time_now)
entity = shared.get_instance_entity()
if entity.task_num < 0:
@@ -92,26 +91,18 @@ def _flush_metrics(time_now):
if updated_sec_ago > shared.INSTANCE_EXPECTED_TO_HAVE_TASK_NUM_SEC:
logging.warning('Instance %s is %d seconds old with no task_num.',
shared.instance_key_id(), updated_sec_ago)
- logging.info('ts_mon: skipping the flush, no task_num')
return False
interface.state.target.task_num = entity.task_num
- logging.info('ts_mon: initiating TSMonInstance entity update')
entity.last_updated = datetime_now
entity_deferred = entity.put_async()
- logging.info('ts_mon: doing the flush')
- started = time.time()
interface.flush()
- logging.info(
- 'ts_mon: flush finished in %d ms', (time.time() - started) * 1000)
for metric in interface.state.global_metrics.itervalues():
metric.reset()
- logging.info('ts_mon: waiting for TSMonInstance entity update to finish')
entity_deferred.get_result()
- logging.info('ts_mon: flush is done')
return True
@@ -218,11 +209,9 @@ def initialize(app=None, is_enabled_fn=None, cron_module='default',
def _instrumented_dispatcher(dispatcher, request, response, time_fn=time.time):
start_time = time_fn()
response_status = 0
- interface.state.store.initialize_context()
flush_thread = None
time_now = time_fn()
if need_to_flush_metrics(time_now):
- logging.info('ts_mon: starting flush thread')
flush_thread = threading.Thread(target=_flush_metrics, args=(time_now,))
flush_thread.start()
try:
@@ -239,12 +228,7 @@ def _instrumented_dispatcher(dispatcher, request, response, time_fn=time.time):
response_status = response.status_int
finally:
if flush_thread:
- start_waiting = time_fn()
- logging.info('ts_mon: joining flush thread')
flush_thread.join()
- logging.info(
- 'ts_mon: flush threads is done, waited %d ms',
- (time_fn() - start_waiting) * 1000)
elapsed_ms = int((time_fn() - start_time) * 1000)
# Use the route template regex, not the request path, to prevent an
@@ -286,7 +270,6 @@ def instrument_endpoint(time_fn=time.time):
endpoint_name = '/_ah/spi/%s.%s' % (service_name, method_name)
start_time = time_fn()
response_status = 0
- interface.state.store.initialize_context()
flush_thread = None
time_now = time_fn()
if need_to_flush_metrics(time_now):
@@ -329,8 +312,6 @@ class DjangoMiddleware(object):
return '<unknown>' # pragma: no cover
def process_view(self, request, view_func, view_args, view_kwargs):
- interface.state.store.initialize_context()
-
time_now = self._time_fn()
state = {
'flush_thread': None,
« no previous file with comments | « appengine/third_party/gae_ts_mon/__init__.py ('k') | client/third_party/infra_libs/README.swarming » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698