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

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

Issue 2705153007: Count configured minimum and maximum numbers of instances (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/gce-backend/config.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 e8cb950ce1239220f01228ac5525b6c85211bc92..36efe76c9dc7791a6a6a0795962b0e61ac783a11 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 config
import instance_group_managers
@@ -24,6 +25,14 @@ GLOBAL_TARGET_FIELDS = {
GLOBAL_METRICS = {
+ 'config_max_instances': gae_ts_mon.GaugeMetric(
+ 'machine_provider/gce_backend/config/instances/max',
+ description='Maximum number of instances currently configured.',
+ ),
+ 'config_min_instances': gae_ts_mon.GaugeMetric(
+ 'machine_provider/gce_backend/config/instances/min',
+ description='Minimum number of instances currently configured.',
+ ),
'instances': gae_ts_mon.GaugeMetric(
'machine_provider/gce_backend/instances',
description='Current count of the number of instances.',
@@ -38,6 +47,24 @@ config_valid = gae_ts_mon.BooleanMetric(
def compute_global_metrics(): # pragma: no cover
+ for name, counts in config.count_instances().iteritems():
+ logging.info('%s min: %s', name, counts[0])
+ GLOBAL_METRICS['config_min_instances'].set(
+ counts[0],
+ fields={
+ 'instance_template': name,
+ },
+ target_fields=GLOBAL_TARGET_FIELDS,
+ )
+ logging.info('%s max: %s', name, counts[1])
+ GLOBAL_METRICS['config_max_instances'].set(
+ counts[1],
+ fields={
+ 'instance_template': name,
+ },
+ target_fields=GLOBAL_TARGET_FIELDS,
+ )
+
for name, count in instance_group_managers.count_instances().iteritems():
logging.info('%s: %s', name, count)
GLOBAL_METRICS['instances'].set(
« no previous file with comments | « appengine/gce-backend/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698