aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From san...@apache.org
Subject aurora git commit: Add missing stats in MesosCallbackHandler
Date Thu, 22 Jun 2017 17:28:19 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 13055df3b -> a922b053e


Add missing stats in MesosCallbackHandler

*Add missing stats in MesosCallbackHandler.

We are thinking about switching to a new driver implementation around V1Mesos (https://reviews.apache.org/r/57061).
The V1 Mesos code requires a Scheduler callback with a different API. To maximize code reuse,
event handling logic was extracted into a MesosCallbackHandler class. However, two metrics
for handling __task status update__, and for handling __framework message__ are missing in
this class.

This CR adds the two missing stats in the MesosCallbackHandler class.

Testing Done:
./build-support/jenkins/build.sh

Bugs closed: AURORA-1937

Reviewed at https://reviews.apache.org/r/60350/


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

Branch: refs/heads/master
Commit: a922b053e9402ed895694c22ed9ca62581ef49bd
Parents: 13055df
Author: Kai Huang <texasred2013@hotmail.com>
Authored: Thu Jun 22 10:27:57 2017 -0700
Committer: Santhosh Kumar <sshanmugham@twitter.com>
Committed: Thu Jun 22 10:27:57 2017 -0700

----------------------------------------------------------------------
 .../apache/aurora/scheduler/mesos/MesosCallbackHandler.java   | 6 ++++++
 .../aurora/scheduler/mesos/MesosCallbackHandlerTest.java      | 7 +++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/a922b053/src/main/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandler.java b/src/main/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandler.java
index 772a04c..60df46c 100644
--- a/src/main/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandler.java
+++ b/src/main/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandler.java
@@ -91,11 +91,13 @@ public interface MesosCallbackHandler {
 
     private final AtomicLong offersRescinded;
     private final AtomicLong slavesLost;
+    private final AtomicLong statusUpdate;
     private final AtomicLong reRegisters;
     private final AtomicLong offersReceived;
     private final AtomicLong inverseOffersReceived;
     private final AtomicLong disconnects;
     private final AtomicLong executorsLost;
+    private final AtomicLong frameworkMessage;
     private final AtomicBoolean frameworkRegistered;
 
     /**
@@ -166,11 +168,13 @@ public interface MesosCallbackHandler {
 
       this.offersRescinded = statsProvider.makeCounter("offers_rescinded");
       this.slavesLost = statsProvider.makeCounter("slaves_lost");
+      this.statusUpdate = statsProvider.makeCounter("scheduler_status_update");
       this.reRegisters = statsProvider.makeCounter("scheduler_framework_reregisters");
       this.offersReceived = statsProvider.makeCounter("scheduler_resource_offers");
       this.inverseOffersReceived = statsProvider.makeCounter("scheduler_inverse_offers");
       this.disconnects = statsProvider.makeCounter("scheduler_framework_disconnects");
       this.executorsLost = statsProvider.makeCounter("scheduler_lost_executors");
+      this.frameworkMessage = statsProvider.makeCounter("scheduler_framework_message");
       this.frameworkRegistered = new AtomicBoolean(false);
       statsProvider.makeGauge("framework_registered", () -> frameworkRegistered.get()
? 1 : 0);
     }
@@ -246,6 +250,7 @@ public interface MesosCallbackHandler {
           "Ignoring framework message from {} on {}.",
           executorID.getValue(),
           agentID.getValue());
+      frameworkMessage.incrementAndGet();
     }
 
     @Override
@@ -295,6 +300,7 @@ public interface MesosCallbackHandler {
       try {
         // The status handler is responsible for acknowledging the update.
         taskStatusHandler.statusUpdate(status);
+        statusUpdate.incrementAndGet();
       } catch (SchedulerException e) {
         log.error("Status update failed due to scheduler exception: " + e, e);
         // We re-throw the exception here to trigger an abort of the driver.

http://git-wip-us.apache.org/repos/asf/aurora/blob/a922b053/src/test/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandlerTest.java
b/src/test/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandlerTest.java
index b955d61..b5fa1c8 100644
--- a/src/test/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandlerTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/mesos/MesosCallbackHandlerTest.java
@@ -333,6 +333,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(STATUS);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test
@@ -350,6 +351,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(status);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test
@@ -367,6 +369,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(status);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test
@@ -384,6 +387,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(status);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test(expected = SchedulerException.class)
@@ -400,6 +404,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(STATUS);
+    assertEquals(0L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test
@@ -424,6 +429,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleUpdate(STATUS_RECONCILIATION);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_status_update"));
   }
 
   @Test
@@ -456,6 +462,7 @@ public class MesosCallbackHandlerTest extends EasyMockTest {
     control.replay();
 
     handler.handleMessage(EXECUTOR_ID, AGENT_ID);
+    assertEquals(1L, statsProvider.getLongValue("scheduler_framework_message"));
   }
 
   @Test


Mime
View raw message