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

Side by Side Diff: appengine/third_party/gae_ts_mon/shared.py

Issue 2708113002: Revert of Add field_specs to all metrics in luci-py (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import contextlib 5 import contextlib
6 6
7 from google.appengine.api import modules 7 from google.appengine.api import modules
8 from google.appengine.api import namespace_manager 8 from google.appengine.api import namespace_manager
9 from google.appengine.ext import ndb 9 from google.appengine.ext import ndb
10 10
11 from infra_libs.ts_mon.common import metrics 11 from infra_libs.ts_mon.common import metrics
12 12
13 REGION = 'appengine' 13 REGION = 'appengine'
14 PUBSUB_PROJECT = 'chrome-infra-mon-pubsub' 14 PUBSUB_PROJECT = 'chrome-infra-mon-pubsub'
15 PUBSUB_TOPIC = 'monacq' 15 PUBSUB_TOPIC = 'monacq'
16 INSTANCE_NAMESPACE = 'ts_mon_instance_namespace' 16 INSTANCE_NAMESPACE = 'ts_mon_instance_namespace'
17 # Duration of inactivity to consider an instance dead. 17 # Duration of inactivity to consider an instance dead.
18 INSTANCE_EXPIRE_SEC = 30 * 60 18 INSTANCE_EXPIRE_SEC = 30 * 60
19 INSTANCE_EXPECTED_TO_HAVE_TASK_NUM_SEC = 5 * 60 19 INSTANCE_EXPECTED_TO_HAVE_TASK_NUM_SEC = 5 * 60
20 INTERNAL_CALLBACK_NAME = '__gae_ts_mon_callback' 20 INTERNAL_CALLBACK_NAME = '__gae_ts_mon_callback'
21 21
22 22
23 appengine_default_version = metrics.StringMetric( 23 appengine_default_version = metrics.StringMetric(
24 'appengine/default_version', 24 'appengine/default_version',
25 'Name of the version currently marked as default.', 25 description='Name of the version currently marked as default.')
26 None)
27 started_counter = metrics.CounterMetric( 26 started_counter = metrics.CounterMetric(
28 'appengine/instances/started', 27 'appengine/instances/started',
29 'Count the number of GAE instance initializations.', 28 description='Count the number of GAE instance initializations.')
30 None)
31 shutdown_counter = metrics.CounterMetric( 29 shutdown_counter = metrics.CounterMetric(
32 'appengine/instances/shutdown', 30 'appengine/instances/shutdown',
33 'Count the number of GAE instance shutdowns.', 31 description='Count the number of GAE instance shutdowns.')
34 None)
35 expired_counter = metrics.CounterMetric( 32 expired_counter = metrics.CounterMetric(
36 'appengine/instances/expired', 33 'appengine/instances/expired',
37 'Count the number of GAE instance expirations due to inactivity.', 34 description=('Count the number of GAE instance expirations '
38 None) 35 'due to inactivity.'))
39 36
40 37
41 global_metrics = {} 38 global_metrics = {}
42 global_metrics_callbacks = {} 39 global_metrics_callbacks = {}
43 40
44 41
45 def reset_for_unittest(): 42 def reset_for_unittest():
46 global global_metrics 43 global global_metrics
47 global global_metrics_callbacks 44 global global_metrics_callbacks
48 global_metrics = {} 45 global_metrics = {}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 try: 112 try:
116 namespace_manager.set_namespace(INSTANCE_NAMESPACE) 113 namespace_manager.set_namespace(INSTANCE_NAMESPACE)
117 yield 114 yield
118 finally: 115 finally:
119 namespace_manager.set_namespace(previous_namespace) 116 namespace_manager.set_namespace(previous_namespace)
120 117
121 118
122 def get_instance_entity(): 119 def get_instance_entity():
123 with instance_namespace_context(): 120 with instance_namespace_context():
124 return Instance.get_or_insert(instance_key_id()) 121 return Instance.get_or_insert(instance_key_id())
OLDNEW
« no previous file with comments | « appengine/third_party/gae_ts_mon/config.py ('k') | client/third_party/infra_libs/event_mon/protos/goma_stats_pb2.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698