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

Unified Diff: appengine/gce-backend/metrics.py

Issue 2520873003: Count instances managed by each instance template (Closed)
Patch Set: Created 4 years, 1 month 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/gce-backend/instance_group_managers.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/gce-backend/metrics.py
diff --git a/appengine/gce-backend/metrics.py b/appengine/gce-backend/metrics.py
index 0b4bf227be14f37c99f68d5bc6e0ccd7259fbd05..4be7545ab366d9de2d123fc6c4e234583d58fe31 100644
--- a/appengine/gce-backend/metrics.py
+++ b/appengine/gce-backend/metrics.py
@@ -9,6 +9,7 @@ import logging
import gae_event_mon
import gae_ts_mon
+import instance_group_managers
import instances
@@ -28,6 +29,10 @@ GLOBAL_METRICS = {
'machine_provider/gce_backend/instances',
description='Current count of the number of instances.',
),
+ 'instances/v2': gae_ts_mon.GaugeMetric(
+ 'machine_provider/gce_backend/instances/v2',
Sergey Berezin (google) 2016/11/23 02:28:25 I'd name it in a more self-descriptive way, e.g. .
smut 2016/11/23 22:50:57 I tried modifying the existing metric and the metr
Sergey Berezin (google) 2016/11/23 23:42:44 No, the field schema should be consistent globally
smut 2016/11/23 23:51:09 No, I don't care about the history. I would prefer
Sergey Berezin (google) 2016/11/24 03:51:47 Great, I deleted the metric - once the update prop
+ description='Current count of the number of instances.',
+ ),
}
@@ -53,6 +58,15 @@ def compute_global_metrics():
},
target_fields=GLOBAL_TARGET_FIELDS,
)
+ for name, count in instance_group_managers.count_instances().iteritems():
+ logging.info('%s: %s', name, count)
+ GLOBAL_METRICS['instances/v2'].set(
+ count,
+ fields={
+ 'instance_template': name,
+ },
+ target_fields=GLOBAL_TARGET_FIELDS,
+ )
def initialize():
« no previous file with comments | « appengine/gce-backend/instance_group_managers.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698