adamdebreceni commented on code in PR #1340:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1340#discussion_r892486920


##########
libminifi/include/core/state/nodes/QueueMetrics.h:
##########
@@ -94,15 +82,20 @@ class QueueMetrics : public ResponseNode {
     return serialized;
   }
 
- protected:
-  std::map<std::string, std::unique_ptr<minifi::Connection>> connections;
+  std::vector<PublishedMetric> calculateMetrics() override {
+    std::vector<PublishedMetric> metrics;
+    for (const auto& [_, connection] : connections_) {
+      metrics.push_back({"queue_data_size", 
static_cast<double>(connection->getQueueDataSize()),
+        {{"connection_uuid", connection->getUUIDStr()}, {"connection_name", 
connection->getName()}, {"metric_class", getName()}}});
+      metrics.push_back({"queue_data_size_max", 
static_cast<double>(connection->getMaxQueueDataSize()),
+        {{"connection_uuid", connection->getUUIDStr()}, {"connection_name", 
connection->getName()}, {"metric_class", getName()}}});
+      metrics.push_back({"queue_size", 
static_cast<double>(connection->getQueueSize()),
+        {{"connection_uuid", connection->getUUIDStr()}, {"connection_name", 
connection->getName()}, {"metric_class", getName()}}});
+      metrics.push_back({"queue_size_max", 
static_cast<double>(connection->getMaxQueueSize()),
+        {{"connection_uuid", connection->getUUIDStr()}, {"connection_name", 
connection->getName()}, {"metric_class", getName()}}});
+    }
+    return metrics;

Review Comment:
   this seems to be similar to the one in `FlowInformation` could we somehow 
unify this part?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to