Repository: mesos
Updated Branches:
  refs/heads/master d35170a91 -> 8e002d91a


Stopped logging optional fields unconditionally in agent handler.

The operation ID and framework ID fields associated with operations
and their status updates are optional, so they should only be logged
if set.

Review: https://reviews.apache.org/r/64590/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e8b50574
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e8b50574
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e8b50574

Branch: refs/heads/master
Commit: e8b505741a31a1394c138510fbf4331b478f308d
Parents: d35170a
Author: Gaston Kleiman <[email protected]>
Authored: Tue Jan 2 11:54:30 2018 -0800
Committer: Greg Mann <[email protected]>
Committed: Tue Jan 2 13:55:57 2018 -0800

----------------------------------------------------------------------
 src/slave/slave.cpp | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e8b50574/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index e0806ab..8ef2394 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7286,19 +7286,29 @@ void Slave::handleResourceProviderMessage(
         case RECOVERING:
         case DISCONNECTED:
         case TERMINATING: {
-          LOG(WARNING) << "Dropping status update of operation '"
-                       << update.status().operation_id() << "' (uuid: "
-                       << operationUUID->toString() << ") for framework "
-                       << update.framework_id() << " because agent is in "
-                       << state << " state";
+          LOG(WARNING)
+            << "Dropping status update of operation"
+            << (update.status().has_operation_id()
+                 ? " '" + stringify(update.status().operation_id()) + "'"
+                 : " with no ID")
+            << " (operation_uuid: " << operationUUID->toString() << ")"
+            << (update.has_framework_id()
+                 ? " for framework " + stringify(update.framework_id())
+                 : " for an operator API call")
+            << " because agent is in " << state << " state";
           break;
         }
         case RUNNING: {
-          LOG(INFO) << "Forwarding status update of "
-                    << (operation == nullptr ? "unknown " : "")
-                    << "operation '" << update.status().operation_id()
-                    << "' (uuid: " << operationUUID->toString()
-                    << ") for framework " << update.framework_id();
+          LOG(INFO)
+            << "Forwarding status update of"
+            << (operation == nullptr ? " unknown" : "") << " operation"
+            << (update.status().has_operation_id()
+                 ? " '" + stringify(update.status().operation_id()) + "'"
+                 : " with no ID")
+            << " (operation_uuid: " << operationUUID->toString() << ")"
+            << (update.has_framework_id()
+                 ? " for framework " + stringify(update.framework_id())
+                 : " for an operator API call");
 
           // The status update from the resource provider didn't
           // provide the agent ID (because the resource provider
@@ -7450,9 +7460,13 @@ void Slave::updateOperation(
   }
 
   LOG(INFO) << "Updating the state of operation '"
-            << operation->info().id()
-            << "' (uuid: " << operation->uuid()
-            << ") of framework " << operation->framework_id()
+            << (operation->info().has_id()
+                 ? " '" + stringify(operation->info().id()) + "'"
+                 : " with no ID")
+            << " (uuid: " << operation->uuid() << ")"
+            << (operation->has_framework_id()
+                 ? " for framework " + stringify(operation->framework_id())
+                 : " for an operation API call")
             << " (latest state: " << operation->latest_status().state()
             << ", status update state: " << status.state() << ")";
 

Reply via email to