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 2016/10/27 20:23:32 UTC
[1/3] mesos git commit: Show the leading master's information in
`/master/state` endpoint.
Repository: mesos
Updated Branches:
refs/heads/1.0.x 5344b88c2 -> ec315f28e
Show the leading master's information in `/master/state` endpoint.
Review: https://reviews.apache.org/r/53193/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ef90134c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ef90134c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ef90134c
Branch: refs/heads/1.0.x
Commit: ef90134ccbcd3239241a6d5571aaaf0192e1c294
Parents: 5344b88
Author: haosdent huang <ha...@gmail.com>
Authored: Thu Oct 27 10:22:09 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Oct 27 13:22:52 2016 -0700
----------------------------------------------------------------------
src/master/http.cpp | 16 ++++++++++++++++
src/tests/master_tests.cpp | 9 ++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef90134c/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index fd0fef6..810cf48 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -142,6 +142,15 @@ static void json(JSON::ObjectWriter* writer, const Offer& offer)
writer->field("resources", Resources(offer.resources()));
}
+
+static void json(JSON::ObjectWriter* writer, const MasterInfo& info)
+{
+ writer->field("id", info.id());
+ writer->field("pid", info.pid());
+ writer->field("port", info.port());
+ writer->field("hostname", info.hostname());
+}
+
namespace internal {
namespace master {
@@ -2618,10 +2627,17 @@ Future<Response> Master::Http::state(
writer->field("activated_slaves", master->_slaves_active());
writer->field("deactivated_slaves", master->_slaves_inactive());
+ // TODO(haosdent): Deprecated this in favor of `leader_info` below.
if (master->leader.isSome()) {
writer->field("leader", master->leader.get().pid());
}
+ if (master->leader.isSome()) {
+ writer->field("leader_info", [this](JSON::ObjectWriter* writer) {
+ json(writer, master->leader.get());
+ });
+ }
+
if (approveViewFlags(flagsApprover)) {
if (master->flags.cluster.isSome()) {
writer->field("cluster", master->flags.cluster.get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef90134c/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index b1d7545..aa8f3e5 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -3040,12 +3040,19 @@ TEST_F(MasterTest, StateEndpoint)
EXPECT_EQ(stringify(master.get()->pid), state.values["pid"]);
EXPECT_EQ(flags.hostname.get(), state.values["hostname"]);
+ JSON::Object leader = state.values["leader_info"].as<JSON::Object>();
+
+ EXPECT_EQ(flags.hostname.get(), leader.values["hostname"]);
+ EXPECT_EQ(
+ master.get()->pid.address.port,
+ leader.values["port"].as<JSON::Number>().as<int>());
+
EXPECT_EQ(0, state.values["activated_slaves"]);
EXPECT_EQ(0, state.values["deactivated_slaves"]);
EXPECT_EQ(flags.cluster.get(), state.values["cluster"]);
- // TODO(bmahler): Test "leader", "log_dir", "external_log_file".
+ // TODO(bmahler): Test "log_dir", "external_log_file".
// TODO(bmahler): Ensure this contains all the flags.
ASSERT_TRUE(state.values["flags"].is<JSON::Object>());
[3/3] mesos git commit: Added MESOS-6446 to CHANGELOG for 1.0.2.
Posted by vi...@apache.org.
Added MESOS-6446 to CHANGELOG for 1.0.2.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ec315f28
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ec315f28
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ec315f28
Branch: refs/heads/1.0.x
Commit: ec315f28e6f86813af3b756be190e1b48c21404d
Parents: 1ca4db7
Author: Vinod Kone <vi...@gmail.com>
Authored: Thu Oct 27 10:28:29 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Oct 27 13:22:56 2016 -0700
----------------------------------------------------------------------
CHANGELOG | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ec315f28/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 46dabb1..2ad544f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,7 @@ All Issues:
* [MESOS-6391] - Command task's sandbox should not be owned by root if it uses container image.
* [MESOS-6393] - Deprecated SSL_ environment variables are non functional already.
* [MESOS-6420] - Mesos Agent leaking sockets when port mapping network isolator is ON
+ * [MESOS-6446] - WebUI redirect doesn't work with stats from /metric/snapshot
** Improvement
* [MESOS-6075] - Avoid libprocess functions in `mesos-containerizer launch`.
[2/3] mesos git commit: Fixed the broken metrics information of
master in WebUI.
Posted by vi...@apache.org.
Fixed the broken metrics information of master in WebUI.
After we introduced redirection on `/master/state` endpoint to the
leading master in `c9153336`, the metrics information in the WebUI
was broken when the current master is not the leading master.
In this patch, we retrieve the leading master from `/master/state`
endpoint and ensure that requests to `/metrics/snapshot` and `/state`
endpoints are always sent to the leading master.
Review: https://reviews.apache.org/r/53172/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1ca4db71
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1ca4db71
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1ca4db71
Branch: refs/heads/1.0.x
Commit: 1ca4db714fd0acc6095a7a0e14c373a3775df528
Parents: ef90134
Author: haosdent huang <ha...@gmail.com>
Authored: Thu Oct 27 10:22:18 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Oct 27 13:22:54 2016 -0700
----------------------------------------------------------------------
src/webui/master/static/js/controllers.js | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1ca4db71/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js b/src/webui/master/static/js/controllers.js
index cf8c2a4..b30794c 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -233,8 +233,7 @@
});
// Update the outermost scope with the metrics/snapshot endpoint.
- function updateMetrics($scope, $timeout, data) {
- var metrics = JSON.parse(data);
+ function updateMetrics($scope, $timeout, metrics) {
$scope.staging_tasks = metrics['master/tasks_staging'];
$scope.starting_tasks = metrics['master/tasks_starting'];
$scope.running_tasks = metrics['master/tasks_running'];
@@ -317,6 +316,18 @@
if (!matched) $scope.navbarActiveTab = null;
});
+ var leadingMasterURL = function(path) {
+ // Use current location as address in case we could not find the
+ // leading master.
+ var address = location.hostname + ':' + location.port;
+ if ($scope.state && $scope.state.leader_info) {
+ address = $scope.state.leader_info.hostname + ':' +
+ $scope.state.leader_info.port;
+ }
+
+ return '//' + address + path;
+ }
+
var popupErrorModal = function() {
if ($scope.delay >= 128000) {
$scope.delay = 2000;
@@ -376,7 +387,7 @@
// the leading master automatically. This would cause a CORS error if we
// use XMLHttpRequest here. To avoid the CORS error, we use JSONP as a
// workaround. Please refer to MESOS-5911 for further details.
- $http.jsonp('master/state?jsonp=JSON_CALLBACK')
+ $http.jsonp(leadingMasterURL('/master/state?jsonp=JSON_CALLBACK'))
.success(function(response) {
if (updateState($scope, $timeout, response)) {
$scope.delay = updateInterval(_.size($scope.agents));
@@ -391,10 +402,9 @@
};
var pollMetrics = function() {
- $http.get('metrics/snapshot',
- {transformResponse: function(data) { return data; }})
- .success(function(data) {
- if (updateMetrics($scope, $timeout, data)) {
+ $http.jsonp(leadingMasterURL('/metrics/snapshot?jsonp=JSON_CALLBACK'))
+ .success(function(response) {
+ if (updateMetrics($scope, $timeout, response)) {
$scope.delay = updateInterval(_.size($scope.agents));
$timeout(pollMetrics, $scope.delay);
}