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


##########
libminifi/src/core/state/nodes/QueueMetrics.cpp:
##########
@@ -0,0 +1,27 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "core/state/nodes/QueueMetrics.h"
+#include "core/Resource.h"
+
+namespace org::apache::nifi::minifi::state::response {
+
+REGISTER_RESOURCE(QueueMetrics, "Node part of an AST that defines queue metric 
information");

Review Comment:
   What does this mean? "Node part of an AST"
   I know the meaning of each word, but not the whole doesn't make sense to me.



##########
docker/test/integration/minifi/core/DockerTestCluster.py:
##########
@@ -283,3 +282,79 @@ def write_content_to_container(self, content, dst):
                 tar.addfile(info, io.BytesIO(content.encode('utf-8')))
             with open(os.path.join(td, 'content.tar'), 'rb') as data:
                 return container.put_archive(os.path.dirname(dst_path), 
data.read())
+
+    def check_metric_class_on_prometheus(self, metric_class, timeout_seconds):
+        start_time = time.perf_counter()
+        while (time.perf_counter() - start_time) < timeout_seconds:
+            if self.verify_metric_class(metric_class):
+                return True
+            time.sleep(1)
+        return False

Review Comment:
   I suggest adding the word "wait" somewhere in functions that wait for a 
condition to occur with a timeout. Maybe "wait_for_metric_class_on_prometheus"?



##########
libminifi/include/FlowController.h:
##########
@@ -252,8 +255,7 @@ class FlowController : public 
core::controller::ForwardingControllerServiceProvi
   // Thread pool for schedulers
   utils::ThreadPool<utils::TaskRescheduleInfo> thread_pool_;
   std::map<utils::Identifier, std::unique_ptr<state::ProcessorController>> 
processor_to_controller_;
+  std::unique_ptr<state::MetricsPublisher> metrics_publisher_;

Review Comment:
   The flow controller shouldn't own this service, or even depend on it. Each 
entity that's capable of exporting metrics should expose that on its public 
interface. The flow controller may provide some aggregation into a single 
structure if necessary, but it shouldn't do much else.
   Let's have the MetricsPublisher depend on a metric source callback, that's 
bound to this aggregation member function of the flow controller, without each 
depending on the other.



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