This is an automated email from the ASF dual-hosted git repository.
alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new a8c411d Logged when `/__processes__` returns.
a8c411d is described below
commit a8c411d3f8d2895ff5e95c412ef2f3e94713520f
Author: Alexander Rukletsov <[email protected]>
AuthorDate: Fri May 3 13:23:50 2019 +0200
Logged when `/__processes__` returns.
Adds a log entry when a response with generated by `/__processes__`
is about to be returned to the client.
Review: https://reviews.apache.org/r/70589
---
3rdparty/libprocess/src/process.cpp | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/3rdparty/libprocess/src/process.cpp
b/3rdparty/libprocess/src/process.cpp
index a47b570..a8d9151 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -403,7 +403,7 @@ public:
void settle();
// The /__processes__ route.
- Future<Response> __processes__(const Request&);
+ Future<Response> __processes__(const Request& request);
void install(Filter* f)
{
@@ -3387,7 +3387,7 @@ void ProcessManager::settle()
}
-Future<Response> ProcessManager::__processes__(const Request&)
+Future<Response> ProcessManager::__processes__(const Request& request)
{
synchronized (processes_mutex) {
return collect(lambda::map(
@@ -3407,14 +3407,27 @@ Future<Response> ProcessManager::__processes__(const
Request&)
});
},
process_manager->processes.values()))
- .then([](const std::vector<Option<JSON::Object>>& objects) -> Response {
+ .then([request](
+ const std::vector<Option<JSON::Object>>& objects) -> Response {
JSON::Array array;
foreach (const Option<JSON::Object>& object, objects) {
if (object.isSome()) {
array.values.push_back(*object);
}
}
- return OK(array);
+
+ Response response = OK(array);
+
+ // TODO(alexr): Generalize response logging in libprocess.
+ VLOG(1) << "HTTP " << request.method << " for " << request.url
+ << (request.client.isSome()
+ ? " from " + stringify(request.client.get())
+ : "")
+ << ": '" << response.status << "'"
+ << " after " << (process::Clock::now() - request.received).ms()
+ << Milliseconds::units();
+
+ return response;
});
}
}