Repository: mesos Updated Branches: refs/heads/master 526e1ee61 -> bf2cc46f9
Add dispatch event counters to Scheduler driver Review: https://reviews.apache.org/r/26951 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bf2cc46f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bf2cc46f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bf2cc46f Branch: refs/heads/master Commit: bf2cc46f987aa9b8b56137e8fbbafb91649902b0 Parents: 526e1ee Author: Dominic Hamon <[email protected]> Authored: Mon Oct 20 12:03:30 2014 -0700 Committer: Dominic Hamon <[email protected]> Committed: Tue Oct 21 13:35:20 2014 -0700 ---------------------------------------------------------------------- src/sched/sched.cpp | 14 +++++++++++++- src/tests/scheduler_tests.cpp | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/bf2cc46f/src/sched/sched.cpp ---------------------------------------------------------------------- diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp index a37ed3d..e89e5e5 100644 --- a/src/sched/sched.cpp +++ b/src/sched/sched.cpp @@ -1010,22 +1010,29 @@ private: Metrics(const SchedulerProcess& schedulerProcess) : event_queue_messages( "scheduler/event_queue_messages", - defer(schedulerProcess, &SchedulerProcess::_event_queue_messages)) + defer(schedulerProcess, &SchedulerProcess::_event_queue_messages)), + event_queue_dispatches( + "scheduler/event_queue_dispatches", + defer(schedulerProcess, + &SchedulerProcess::_event_queue_dispatches)) { // TODO(dhamon): When we start checking the return value of 'add' we may // get failures in situations where multiple SchedulerProcesses are active // (ie, the fault tolerance tests). At that point we'll need MESOS-1285 to // be fixed and to use self().id in the metric name. process::metrics::add(event_queue_messages); + process::metrics::add(event_queue_dispatches); } ~Metrics() { process::metrics::remove(event_queue_messages); + process::metrics::remove(event_queue_dispatches); } // Process metrics. process::metrics::Gauge event_queue_messages; + process::metrics::Gauge event_queue_dispatches; } metrics; double _event_queue_messages() @@ -1033,6 +1040,11 @@ private: return static_cast<double>(eventCount<MessageEvent>()); } + double _event_queue_dispatches() + { + return static_cast<double>(eventCount<DispatchEvent>()); + } + MesosSchedulerDriver* driver; Scheduler* scheduler; FrameworkInfo framework; http://git-wip-us.apache.org/repos/asf/mesos/blob/bf2cc46f/src/tests/scheduler_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp index d6a7867..6502161 100644 --- a/src/tests/scheduler_tests.cpp +++ b/src/tests/scheduler_tests.cpp @@ -242,6 +242,7 @@ TEST_F(MesosSchedulerDriverTest, MetricsEndpoint) JSON::Object metrics = parse.get(); EXPECT_EQ(1u, metrics.values.count("scheduler/event_queue_messages")); + EXPECT_EQ(1u, metrics.values.count("scheduler/event_queue_dispatches")); driver.stop(); driver.join();
