You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2015/09/12 11:22:08 UTC
[3/3] mesos git commit: Removed '.json' extension in slave endpoints
url.
Removed '.json' extension in slave endpoints url.
Added HTTP endpoints in slave without the json extension.
Review: https://reviews.apache.org/r/36126
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7b8da01d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7b8da01d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7b8da01d
Branch: refs/heads/master
Commit: 7b8da01ddb9f4c70159ca60758df109555204977
Parents: c1b11ac
Author: Isabel Jimenez <co...@isabeljimenez.com>
Authored: Fri Sep 11 22:19:21 2015 -0700
Committer: Adam B <ad...@mesosphere.io>
Committed: Sat Sep 12 02:21:32 2015 -0700
----------------------------------------------------------------------
docs/network-monitoring.md | 4 ++--
src/cli/mesos-cat | 4 ++--
src/cli/mesos-ps | 2 +-
src/cli/mesos-tail | 4 ++--
src/slave/monitor.cpp | 8 +++++++-
src/slave/slave.cpp | 16 ++++++++++++----
src/slave/slave.hpp | 2 +-
src/tests/fault_tolerance_tests.cpp | 6 +++---
src/tests/monitor_tests.cpp | 12 ++++++------
src/tests/slave_tests.cpp | 8 ++++----
src/webui/master/static/js/controllers.js | 10 +++++-----
src/webui/master/static/js/services.js | 2 +-
12 files changed, 46 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/docs/network-monitoring.md
----------------------------------------------------------------------
diff --git a/docs/network-monitoring.md b/docs/network-monitoring.md
index acd70c5..b266ae5 100644
--- a/docs/network-monitoring.md
+++ b/docs/network-monitoring.md
@@ -290,9 +290,9 @@ for each of these elements includes:
[3] Currently always reported as 0 by the underlying Traffic Control element.
-For example, these are the statistics you will get by hitting the `/monitor/statistics.json` endpoint on a slave with network monitoring turned on:
+For example, these are the statistics you will get by hitting the `/monitor/statistics` endpoint on a slave with network monitoring turned on:
- $ curl -s http://localhost:5051/monitor/statistics.json | python2.6 -mjson.tool
+ $ curl -s http://localhost:5051/monitor/statistics | python2.6 -mjson.tool
[
{
"executor_id": "job.1436298853",
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/cli/mesos-cat
----------------------------------------------------------------------
diff --git a/src/cli/mesos-cat b/src/cli/mesos-cat
index 73dc63e..24a1e64 100755
--- a/src/cli/mesos-cat
+++ b/src/cli/mesos-cat
@@ -26,9 +26,9 @@ def read(slave, task, file):
# uses the same executor ID as task ID in the slave.
if executor_id == '': executor_id = task['id']
- # Get 'state.json' to determine the executor directory.
+ # Get 'state' json to determine the executor directory.
try:
- state = json.loads(http.get(slave['pid'], '/state.json'))
+ state = json.loads(http.get(slave['pid'], '/state'))
except:
fatal('Failed to get state from slave')
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/cli/mesos-ps
----------------------------------------------------------------------
diff --git a/src/cli/mesos-ps b/src/cli/mesos-ps
index ee14d51..7976069 100755
--- a/src/cli/mesos-ps
+++ b/src/cli/mesos-ps
@@ -196,7 +196,7 @@ def main():
slaves = [slave for slave in state['slaves'] if slave['id'] in active]
# Now submit calls to get the statistics for each slave.
- path = '/monitor/statistics.json'
+ path = '/monitor/statistics'
futures = dict((executor.submit(http.get, slave['pid'], path), slave)
for slave in slaves)
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/cli/mesos-tail
----------------------------------------------------------------------
diff --git a/src/cli/mesos-tail b/src/cli/mesos-tail
index 256a804..6acec2c 100755
--- a/src/cli/mesos-tail
+++ b/src/cli/mesos-tail
@@ -26,9 +26,9 @@ def read_forever(slave, task, file):
# uses the same executor ID as task ID in the slave.
if executor_id == "": executor_id = task['id']
- # Get 'state.json' to get the executor directory.
+ # Get 'state' json to get the executor directory.
try:
- state = json.loads(http.get(slave['pid'], '/state.json'))
+ state = json.loads(http.get(slave['pid'], '/state'))
except:
fatal('Failed to get state from slave')
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/slave/monitor.cpp
----------------------------------------------------------------------
diff --git a/src/slave/monitor.cpp b/src/slave/monitor.cpp
index 93ba279..8d8b422 100644
--- a/src/slave/monitor.cpp
+++ b/src/slave/monitor.cpp
@@ -93,9 +93,15 @@ public:
protected:
virtual void initialize()
{
+ // TODO(ijimenez): Remove this endpoint at the end of the
+ // deprecation cycle on 0.26.
route("/statistics.json",
STATISTICS_HELP(),
&ResourceMonitorProcess::statistics);
+
+ route("/statistics",
+ STATISTICS_HELP(),
+ &ResourceMonitorProcess::statistics);
}
private:
@@ -147,7 +153,7 @@ private:
// Callback used to retrieve resource usage information from slave.
const lambda::function<Future<ResourceUsage>()> usage;
- // Used to rate limit the statistics.json endpoint.
+ // Used to rate limit the statistics endpoint.
RateLimiter limiter;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 5e5522e..44865bd 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -494,17 +494,25 @@ void Slave::initialize()
// Setup HTTP routes.
Http http = Http(this);
- route("/health",
- Http::HEALTH_HELP,
+ // TODO(ijimenez): Remove this endpoint at the end of the
+ // deprecation cycle on 0.26.
+ route("/state.json",
+ Http::STATE_HELP,
[http](const process::http::Request& request) {
- return http.health(request);
+ Http::log(request);
+ return http.state(request);
});
- route("/state.json",
+ route("/state",
Http::STATE_HELP,
[http](const process::http::Request& request) {
Http::log(request);
return http.state(request);
});
+ route("/health",
+ Http::HEALTH_HELP,
+ [http](const process::http::Request& request) {
+ return http.health(request);
+ });
// Expose the log file for the webui. Fall back to 'log_dir' if
// an explicit file was not specified.
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 09172f7..32e1830 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -403,7 +403,7 @@ private:
process::Future<process::http::Response> health(
const process::http::Request& request) const;
- // /slave/state.json
+ // /slave/state
process::Future<process::http::Response> state(
const process::http::Request& request) const;
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/tests/fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fault_tolerance_tests.cpp b/src/tests/fault_tolerance_tests.cpp
index 89cb18b..82f8cfd 100644
--- a/src/tests/fault_tolerance_tests.cpp
+++ b/src/tests/fault_tolerance_tests.cpp
@@ -235,7 +235,7 @@ TEST_F(FaultToleranceTest, ReregisterCompletedFrameworks)
EXPECT_EQ(1u,
masterJSON.values["frameworks"].as<JSON::Array>().values.size());
- Future<Response> slaveState = process::http::get(slave.get(), "state.json");
+ Future<Response> slaveState = process::http::get(slave.get(), "state");
parse = JSON::parse<JSON::Object>(slaveState.get().body);
ASSERT_SOME(parse);
@@ -272,7 +272,7 @@ TEST_F(FaultToleranceTest, ReregisterCompletedFrameworks)
EXPECT_EQ(1u,
masterJSON.values["frameworks"].as<JSON::Array>().values.size());
- slaveState = process::http::get(slave.get(), "state.json");
+ slaveState = process::http::get(slave.get(), "state");
parse = JSON::parse<JSON::Object>(slaveState.get().body);
ASSERT_SOME(parse);
slaveJSON = parse.get();
@@ -299,7 +299,7 @@ TEST_F(FaultToleranceTest, ReregisterCompletedFrameworks)
Clock::resume();
// Verify slave sees completed framework.
- slaveState = process::http::get(slave.get(), "state.json");
+ slaveState = process::http::get(slave.get(), "state");
parse = JSON::parse<JSON::Object>(slaveState.get().body);
ASSERT_SOME(parse);
slaveJSON = parse.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/tests/monitor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/monitor_tests.cpp b/src/tests/monitor_tests.cpp
index 53fb53e..f404955 100644
--- a/src/tests/monitor_tests.cpp
+++ b/src/tests/monitor_tests.cpp
@@ -97,7 +97,7 @@ TEST(MonitorTest, Statistics)
UPID upid("monitor", process::address());
- Future<http::Response> response = http::get(upid, "statistics.json");
+ Future<http::Response> response = http::get(upid, "statistics");
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
@@ -147,7 +147,7 @@ TEST(MonitorTest, Statistics)
}
-// This test verifies the correct handling of the statistics.json
+// This test verifies the correct handling of the statistics
// endpoint when there is no executor running.
TEST(MonitorTest, NoExecutor)
{
@@ -157,7 +157,7 @@ TEST(MonitorTest, NoExecutor)
UPID upid("monitor", process::address());
- Future<http::Response> response = http::get(upid, "statistics.json");
+ Future<http::Response> response = http::get(upid, "statistics");
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
@@ -169,7 +169,7 @@ TEST(MonitorTest, NoExecutor)
}
-// This test verifies the correct handling of the statistics.json
+// This test verifies the correct handling of the statistics
// endpoint when statistics is missing in ResourceUsage.
TEST(MonitorTest, MissingStatistics)
{
@@ -198,7 +198,7 @@ TEST(MonitorTest, MissingStatistics)
UPID upid("monitor", process::address());
- Future<http::Response> response = http::get(upid, "statistics.json");
+ Future<http::Response> response = http::get(upid, "statistics");
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
@@ -262,7 +262,7 @@ TEST_F(MonitorIntegrationTest, RunningExecutor)
// resource statistics for the running container.
UPID upid("monitor", process::address());
- Future<http::Response> response = http::get(upid, "statistics.json");
+ Future<http::Response> response = http::get(upid, "statistics");
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 5c1a3d3..447c43c 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -1045,7 +1045,7 @@ TEST_F(SlaveTest, StateEndpoint)
ASSERT_SOME(slave);
Future<process::http::Response> response =
- process::http::get(slave.get(), "state.json");
+ process::http::get(slave.get(), "state");
AWAIT_EXPECT_RESPONSE_STATUS_EQ(process::http::OK().status, response);
@@ -1157,7 +1157,7 @@ TEST_F(SlaveTest, StateEndpoint)
AWAIT_READY(status);
EXPECT_EQ(TASK_RUNNING, status.get().state());
- response = http::get(slave.get(), "state.json");
+ response = http::get(slave.get(), "state");
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
@@ -2079,9 +2079,9 @@ TEST_F(SlaveTest, TaskLabels)
AWAIT_READY(update);
- // Verify label key and value in slave state.json.
+ // Verify label key and value in slave state endpoint.
Future<process::http::Response> response =
- process::http::get(slave.get(), "state.json");
+ process::http::get(slave.get(), "state");
AWAIT_READY(response);
EXPECT_SOME_EQ(
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/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 fbf8696..6b46ab2 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -427,7 +427,7 @@
$top.start(host, $scope);
}
- $http.jsonp('//' + host + '/' + id + '/state.json?jsonp=JSON_CALLBACK')
+ $http.jsonp('//' + host + '/' + id + '/state?jsonp=JSON_CALLBACK')
.success(function (response) {
$scope.state = response;
@@ -505,7 +505,7 @@
$top.start(host, $scope);
}
- $http.jsonp('//' + host + '/' + id + '/state.json?jsonp=JSON_CALLBACK')
+ $http.jsonp('//' + host + '/' + id + '/state?jsonp=JSON_CALLBACK')
.success(function (response) {
$scope.state = response;
@@ -578,7 +578,7 @@
$top.start(host, $scope);
}
- $http.jsonp('//' + host + '/' + id + '/state.json?jsonp=JSON_CALLBACK')
+ $http.jsonp('//' + host + '/' + id + '/state?jsonp=JSON_CALLBACK')
.success(function (response) {
$scope.state = response;
@@ -683,7 +683,7 @@
// Request slave details to get access to the route executor's "directory"
// to navigate directly to the executor's sandbox.
- $http.jsonp('//' + host + '/' + id + '/state.json?jsonp=JSON_CALLBACK')
+ $http.jsonp('//' + host + '/' + id + '/state?jsonp=JSON_CALLBACK')
.success(function(response) {
function matchFramework(framework) {
@@ -753,7 +753,7 @@
var hostname = $scope.slaves[$routeParams.slave_id].hostname;
var id = pid.substring(0, pid.indexOf('@'));
var host = hostname + ":" + pid.substring(pid.lastIndexOf(':') + 1);
- var url = '//' + host + '/files/browse.json?jsonp=JSON_CALLBACK';
+ var url = '//' + host + '/files/browse?jsonp=JSON_CALLBACK';
$scope.slave_host = host;
http://git-wip-us.apache.org/repos/asf/mesos/blob/7b8da01d/src/webui/master/static/js/services.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/services.js b/src/webui/master/static/js/services.js
index 2cd9d7d..d41bc71 100644
--- a/src/webui/master/static/js/services.js
+++ b/src/webui/master/static/js/services.js
@@ -271,7 +271,7 @@
return;
}
- this.endpoint = '//' + host + '/monitor/statistics.json?jsonp=JSON_CALLBACK';
+ this.endpoint = '//' + host + '/monitor/statistics?jsonp=JSON_CALLBACK';
this.scope = scope;
// Initial poll is immediate.