You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/01/28 22:45:50 UTC

[1/2] git commit: Added 'active_tasks' stat to master stats endpoint.

Updated Branches:
  refs/heads/master 49b473083 -> 16354796d


Added 'active_tasks' stat to master stats endpoint.

Review: https://reviews.apache.org/r/17442


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a74c000e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a74c000e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a74c000e

Branch: refs/heads/master
Commit: a74c000e925c5fed8e1aca3dd15eaf6a465a6060
Parents: 49b4730
Author: Vinod Kone <vi...@twitter.com>
Authored: Mon Jan 27 18:13:39 2014 -0800
Committer: Vinod Kone <vi...@twitter.com>
Committed: Tue Jan 28 10:03:48 2014 -0800

----------------------------------------------------------------------
 src/master/http.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a74c000e/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 546e91d..fb15483 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -325,6 +325,9 @@ Future<Response> Master::Http::stats(const Request& request)
   object.values["active_schedulers"] = master.getActiveFrameworks().size();
   object.values["activated_slaves"] = master.slaves.size();
   object.values["deactivated_slaves"] = master.deactivatedSlaves.size();
+  object.values["outstanding_offers"] = master.offers.size();
+
+  // NOTE: These are monotonically increasing counters.
   object.values["staged_tasks"] = master.stats.tasks[TASK_STAGING];
   object.values["started_tasks"] = master.stats.tasks[TASK_STARTING];
   object.values["finished_tasks"] = master.stats.tasks[TASK_FINISHED];
@@ -333,7 +336,16 @@ Future<Response> Master::Http::stats(const Request& request)
   object.values["lost_tasks"] = master.stats.tasks[TASK_LOST];
   object.values["valid_status_updates"] = master.stats.validStatusUpdates;
   object.values["invalid_status_updates"] = master.stats.invalidStatusUpdates;
-  object.values["outstanding_offers"] = master.offers.size();
+
+  // Get a count of all active tasks in the cluster i.e., the tasks
+  // that are launched (TASK_STAGING, TASK_STARTING, TASK_RUNNING) but
+  // haven't reached terminal state yet.
+  // NOTE: This is a gauge representing an instantaneous value.
+  int active_tasks = 0;
+  foreachvalue (Framework* framework, master.frameworks) {
+    active_tasks += framework->tasks.size();
+  }
+  object.values["active_tasks_gauge"] = active_tasks;
 
   // Get total and used (note, not offered) resources in order to
   // compute capacity of scalar resources.


[2/2] git commit: Added queued and launched tasks to slave stats.

Posted by vi...@apache.org.
Added queued and launched tasks to slave stats.

Review: https://reviews.apache.org/r/17443


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/16354796
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/16354796
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/16354796

Branch: refs/heads/master
Commit: 16354796d00302eac3e91749df64ec34d2cc48f5
Parents: a74c000
Author: Vinod Kone <vi...@twitter.com>
Authored: Mon Jan 27 18:41:05 2014 -0800
Committer: Vinod Kone <vi...@twitter.com>
Committed: Tue Jan 28 10:04:22 2014 -0800

----------------------------------------------------------------------
 src/slave/http.cpp | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/16354796/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index c8357e2..c4f598f 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -285,6 +285,10 @@ Future<Response> Slave::Http::stats(const Request& request)
   JSON::Object object;
   object.values["uptime"] = (Clock::now() - slave.startTime).secs();
   object.values["total_frameworks"] = slave.frameworks.size();
+  object.values["registered"] = slave.master.isSome() ? "1" : "0";
+  object.values["recovery_errors"] = slave.recoveryErrors;
+
+  // NOTE: These are monotonically increasing counters.
   object.values["staged_tasks"] = slave.stats.tasks[TASK_STAGING];
   object.values["started_tasks"] = slave.stats.tasks[TASK_STARTING];
   object.values["finished_tasks"] = slave.stats.tasks[TASK_FINISHED];
@@ -293,8 +297,24 @@ Future<Response> Slave::Http::stats(const Request& request)
   object.values["lost_tasks"] = slave.stats.tasks[TASK_LOST];
   object.values["valid_status_updates"] = slave.stats.validStatusUpdates;
   object.values["invalid_status_updates"] = slave.stats.invalidStatusUpdates;
-  object.values["registered"] = slave.master.isSome() ? "1" : "0";
-  object.values["recovery_errors"] = slave.recoveryErrors;
+
+  // NOTE: These are gauges representing instantaneous values.
+
+  // Queued waiting for executor to register.
+  int queued_tasks = 0;
+
+  // Sent to executor (TASK_STAGING, TASK_STARTING, TASK_RUNNING).
+  int launched_tasks = 0;
+
+  foreachvalue (Framework* framework, slave.frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      queued_tasks += executor->queuedTasks.size();
+      launched_tasks += executor->launchedTasks.size();
+    }
+  }
+
+  object.values["queued_tasks_gauge"] = queued_tasks;
+  object.values["launched_tasks_gauge"] = launched_tasks;
 
   return OK(object, request.query.get("jsonp"));
 }