You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/09/07 00:24:54 UTC

[mesos] branch 1.7.x updated (7000e72 -> ac38ed9)

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a change to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git.


    from 7000e72  Added MESOS-7947 to the 1.7.0 CHANGELOG.
     new 875fe9b  Avoided double copying of outgoing messages in the master.
     new ac38ed9  Added MESOS-9213 to the 1.7.0 CHANGELOG.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG              |   1 +
 src/master/master.hpp  |   4 +-
 src/master/metrics.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++--
 src/master/metrics.hpp |  14 +++++++
 4 files changed, 113 insertions(+), 6 deletions(-)


[mesos] 01/02: Avoided double copying of outgoing messages in the master.

Posted by bm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 875fe9b61623254ec11665fd8c089ba492260798
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Thu Sep 6 15:31:48 2018 -0700

    Avoided double copying of outgoing messages in the master.
    
    When framework metrics were introduced, there was an evolve + devolve
    conversion occuring in order to map old style messages to the new
    `scheduler::Event::Type`. This results in copying all outgoing
    messages twice.
    
    This patch avoids the copying by adding overloads for the old style
    messages.
    
    Review: https://reviews.apache.org/r/68662
---
 src/master/master.hpp  |   4 +-
 src/master/metrics.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++--
 src/master/metrics.hpp |  14 +++++++
 3 files changed, 112 insertions(+), 6 deletions(-)

diff --git a/src/master/master.hpp b/src/master/master.hpp
index 7b11c32..fedc581 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -2533,9 +2533,7 @@ void Framework::send(const Message& message)
                  << " framework " << *this;
   }
 
-  // TODO(gilbert): add a helper to transform `SchedulerDriver` API messages
-  // directly to v0 events.
-  metrics.incrementEvent(devolve(evolve(message)));
+  metrics.incrementEvent(message);
 
   if (http.isSome()) {
     if (!http->send(message)) {
diff --git a/src/master/metrics.cpp b/src/master/metrics.cpp
index 655c75a..56a7eef 100644
--- a/src/master/metrics.cpp
+++ b/src/master/metrics.cpp
@@ -755,10 +755,104 @@ string getFrameworkMetricPrefix(const FrameworkInfo& frameworkInfo)
 
 void FrameworkMetrics::incrementEvent(const scheduler::Event& event)
 {
-  CHECK(event_types.contains(event.type()));
+  ++CHECK_NOTNONE(event_types.get(event.type()));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const FrameworkErrorMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::ERROR));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const ExitedExecutorMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::FAILURE));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const LostSlaveMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::FAILURE));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const InverseOffersMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::INVERSE_OFFERS));
+  ++events;
+}
+
 
-  event_types.get(event.type()).get()++;
-  events++;
+void FrameworkMetrics::incrementEvent(
+    const ExecutorToFrameworkMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::MESSAGE));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const ResourceOffersMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::OFFERS));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const RescindResourceOfferMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::RESCIND));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const RescindInverseOfferMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::RESCIND_INVERSE_OFFER));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const FrameworkRegisteredMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::SUBSCRIBED));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const FrameworkReregisteredMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::SUBSCRIBED));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const StatusUpdateMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::UPDATE));
+  ++events;
+}
+
+
+void FrameworkMetrics::incrementEvent(
+    const UpdateOperationStatusMessage& message)
+{
+  ++CHECK_NOTNONE(event_types.get(scheduler::Event::UPDATE_OPERATION_STATUS));
+  ++events;
 }
 
 } // namespace master {
diff --git a/src/master/metrics.hpp b/src/master/metrics.hpp
index df28a48..a805515 100644
--- a/src/master/metrics.hpp
+++ b/src/master/metrics.hpp
@@ -228,6 +228,20 @@ struct FrameworkMetrics
 
   void incrementEvent(const scheduler::Event& event);
 
+  // Overloads to convert unversioned messages into events.
+  void incrementEvent(const FrameworkErrorMessage& message);
+  void incrementEvent(const ExitedExecutorMessage& message);
+  void incrementEvent(const LostSlaveMessage& message);
+  void incrementEvent(const InverseOffersMessage& message);
+  void incrementEvent(const ExecutorToFrameworkMessage& message);
+  void incrementEvent(const ResourceOffersMessage& message);
+  void incrementEvent(const RescindResourceOfferMessage& message);
+  void incrementEvent(const RescindInverseOfferMessage& message);
+  void incrementEvent(const FrameworkRegisteredMessage& message);
+  void incrementEvent(const FrameworkReregisteredMessage& message);
+  void incrementEvent(const StatusUpdateMessage& message);
+  void incrementEvent(const UpdateOperationStatusMessage& message);
+
   void incrementTaskState(const TaskState& state);
   void decrementActiveTaskState(const TaskState& state);
 


[mesos] 02/02: Added MESOS-9213 to the 1.7.0 CHANGELOG.

Posted by bm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit ac38ed9c4426e439db968a54857deabf02f63e81
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Thu Sep 6 17:24:05 2018 -0700

    Added MESOS-9213 to the 1.7.0 CHANGELOG.
---
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG b/CHANGELOG
index 588eb82..a9237dc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -288,6 +288,7 @@ All Resolved Issues:
   * [MESOS-9122] - Batch '/state' requests in the Master actor.
   * [MESOS-9129] - Port mapper CNI plugin should use '-n' option with 'iptables --list'
   * [MESOS-9189] - Include 'Connection: close' header in master streaming API responses.
+  * [MESOS-9213] - Avoid double copying of master->framework messages when incrementing metrics.
 
 ** Task
   * [MESOS-2633] - Move implementations of Framework struct functions out of master.hpp.