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

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

Issue 2520873003: Count instances managed by each instance template (Closed)
Patch Set: Replace old metric with new 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') | appengine/gce-backend/metrics.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/gce-backend/instances.py
diff --git a/appengine/gce-backend/instances.py b/appengine/gce-backend/instances.py
index 2ef9079e88df6e80c253c00bfad1c203f6273b1e..86f5b3227f5fd8e842f75b04fb618ad864833190 100644
--- a/appengine/gce-backend/instances.py
+++ b/appengine/gce-backend/instances.py
@@ -376,23 +376,3 @@ def schedule_drained_deletion():
):
logging.warning(
'Failed to enqueue task for Instance: %s', instance.key)
-
-
-def count_instances():
- """Counts the number of Instance entities in the datastore.
-
- Returns:
- A 2-tuple of (orphaned, total).
- Orphaned instances are instances no longer referred to by their parent.
- """
- total = 0
- orphaned = 0
- for instance in models.Instance.query():
- total += 1
- instance_group_manager = instance.instance_group_manager.get()
- if (not instance_group_manager
- or instance.key not in instance_group_manager.instances):
- logging.warning('Found orphaned Instance: %s', instance.key)
- orphaned += 1
- logging.info('Orphaned Instances: %s/%s', orphaned, total)
- return orphaned, total
« no previous file with comments | « appengine/gce-backend/instance_group_managers.py ('k') | appengine/gce-backend/metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698