bakaid commented on a change in pull request #734: MINIFICPP-1157 Implement 
lightweight C2 heartbeat.
URL: https://github.com/apache/nifi-minifi-cpp/pull/734#discussion_r378765083
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -553,6 +577,20 @@ void C2Agent::handle_describe(const C2ContentResponse 
&resp) {
     }
     response.addPayload(std::move(options));
 
+    auto reporter = 
std::dynamic_pointer_cast<state::response::NodeReporter>(update_sink_);
+    if (reporter != nullptr) {
+      std::vector<std::shared_ptr<state::response::ResponseNode>> metrics_vec;
+
+      C2Payload agentInfo(Operation::ACKNOWLEDGE, resp.ident, false, true);
+      agentInfo.setLabel("agentInfo");
+
+      reporter->getManifestNodes(metrics_vec);
+      for (auto& metric : metrics_vec) {
+          serializeMetrics(agentInfo, metric->getName(), metric->serialize());
+      }
+      response.addPayload(std::move(agentInfo));
+    }
+
     if (device_information_.size() > 0) {
 
 Review comment:
   I know this is not new code, but I don't see any place where `C2Agent`'s 
`device_information_` would get filled, making this dead code (along with its 
counterpart in `performHeartBeat`).
   Device information seems to be sourced and transmitted from the 
`DeviceInfoNode` as a "deviceInfo" root node anyway, and not as 
"AgentInformation".

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to