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 2016/03/05 05:46:01 UTC
mesos git commit: Moved metrics of the hierarchical allocator to a
separate file.
Repository: mesos
Updated Branches:
refs/heads/master d26baee1f -> b770eecfc
Moved metrics of the hierarchical allocator to a separate file.
To be consistent with the Master and Slave metrics.{hpp,cpp} files,
this adds metrics.{hpp,cpp} files for the hierarchical allocator.
Review: https://reviews.apache.org/r/44260/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b770eecf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b770eecf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b770eecf
Branch: refs/heads/master
Commit: b770eecfc30cf80136d60fc799b8379fc4b380a7
Parents: d26baee
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Fri Mar 4 20:30:59 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 4 20:45:54 2016 -0800
----------------------------------------------------------------------
src/CMakeLists.txt | 1 +
src/Makefile.am | 2 +
src/master/allocator/mesos/hierarchical.hpp | 23 ++----------
src/master/allocator/mesos/metrics.cpp | 48 ++++++++++++++++++++++++
src/master/allocator/mesos/metrics.hpp | 47 +++++++++++++++++++++++
5 files changed, 102 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b770eecf/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0eabfad..8f57a57 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -210,6 +210,7 @@ set(MASTER_SRC
master/validation.cpp
master/allocator/allocator.cpp
master/allocator/mesos/hierarchical.cpp
+ master/allocator/mesos/metrics.cpp
master/allocator/sorter/drf/sorter.cpp
)
http://git-wip-us.apache.org/repos/asf/mesos/blob/b770eecf/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b54fe0..a41e95d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -629,6 +629,7 @@ libmesos_no_3rdparty_la_SOURCES += \
master/validation.cpp \
master/allocator/allocator.cpp \
master/allocator/mesos/hierarchical.cpp \
+ master/allocator/mesos/metrics.cpp \
master/allocator/sorter/drf/sorter.cpp \
messages/messages.cpp \
module/manager.cpp \
@@ -741,6 +742,7 @@ libmesos_no_3rdparty_la_SOURCES += \
master/validation.hpp \
master/allocator/mesos/allocator.hpp \
master/allocator/mesos/hierarchical.hpp \
+ master/allocator/mesos/metrics.hpp \
master/allocator/sorter/sorter.hpp \
master/allocator/sorter/drf/sorter.hpp \
messages/flags.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/b770eecf/src/master/allocator/mesos/hierarchical.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp
index 3043888..52b3a9b 100644
--- a/src/master/allocator/mesos/hierarchical.hpp
+++ b/src/master/allocator/mesos/hierarchical.hpp
@@ -23,8 +23,6 @@
#include <process/future.hpp>
#include <process/id.hpp>
-#include <process/metrics/gauge.hpp>
-#include <process/metrics/metrics.hpp>
#include <stout/duration.hpp>
#include <stout/hashmap.hpp>
@@ -32,6 +30,8 @@
#include <stout/option.hpp>
#include "master/allocator/mesos/allocator.hpp"
+#include "master/allocator/mesos/metrics.hpp"
+
#include "master/allocator/sorter/drf/sorter.hpp"
#include "master/constants.hpp"
@@ -263,23 +263,8 @@ protected:
void(const FrameworkID&,
const hashmap<SlaveID, UnavailableResources>&)> inverseOfferCallback;
- struct Metrics
- {
- explicit Metrics(const Self& process)
- : event_queue_dispatches(
- "allocator/event_queue_dispatches",
- process::defer(process.self(), &Self::_event_queue_dispatches))
- {
- process::metrics::add(event_queue_dispatches);
- }
-
- ~Metrics()
- {
- process::metrics::remove(event_queue_dispatches);
- }
-
- process::metrics::Gauge event_queue_dispatches;
- } metrics;
+ friend Metrics;
+ Metrics metrics;
struct Framework
{
http://git-wip-us.apache.org/repos/asf/mesos/blob/b770eecf/src/master/allocator/mesos/metrics.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/metrics.cpp b/src/master/allocator/mesos/metrics.cpp
new file mode 100644
index 0000000..46dd7f7
--- /dev/null
+++ b/src/master/allocator/mesos/metrics.cpp
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <process/metrics/metrics.hpp>
+
+#include "master/allocator/mesos/hierarchical.hpp"
+#include "master/allocator/mesos/metrics.hpp"
+
+namespace mesos {
+namespace internal {
+namespace master {
+namespace allocator {
+namespace internal {
+
+Metrics::Metrics(const HierarchicalAllocatorProcess& allocator)
+ : event_queue_dispatches(
+ "allocator/event_queue_dispatches",
+ process::defer(
+ allocator.self(),
+ &HierarchicalAllocatorProcess::_event_queue_dispatches))
+{
+ process::metrics::add(event_queue_dispatches);
+}
+
+
+Metrics::~Metrics()
+{
+ process::metrics::remove(event_queue_dispatches);
+}
+
+} // namespace internal {
+} // namespace allocator {
+} // namespace master {
+} // namespace internal {
+} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b770eecf/src/master/allocator/mesos/metrics.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/metrics.hpp b/src/master/allocator/mesos/metrics.hpp
new file mode 100644
index 0000000..d04e9a1
--- /dev/null
+++ b/src/master/allocator/mesos/metrics.hpp
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __MASTER_ALLOCATOR_MESOS_METRICS_HPP__
+#define __MASTER_ALLOCATOR_MESOS_METRICS_HPP__
+
+#include <process/metrics/gauge.hpp>
+
+namespace mesos {
+namespace internal {
+namespace master {
+namespace allocator {
+namespace internal {
+
+// Forward declarations.
+class HierarchicalAllocatorProcess;
+
+class Metrics
+{
+public:
+ explicit Metrics(const HierarchicalAllocatorProcess& allocator);
+
+ ~Metrics();
+
+ process::metrics::Gauge event_queue_dispatches;
+};
+
+} // namespace internal {
+} // namespace allocator {
+} // namespace master {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // __MASTER_ALLOCATOR_MESOS_METRICS_HPP__