You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/12/14 11:37:34 UTC

[GitHub] [nifi-minifi-cpp] lordgamez opened a new pull request, #1477: MINIFICPP-2016 Add session commit time metrics

lordgamez opened a new pull request, #1477:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1477

   https://issues.apache.org/jira/browse/MINIFICPP-2016
   
   --------------------------
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1477: MINIFICPP-2016 Add session commit time metrics

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #1477:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1477#discussion_r1087563159


##########
libminifi/src/core/ProcessorMetrics.cpp:
##########
@@ -105,6 +110,17 @@ std::chrono::milliseconds ProcessorMetrics::getLastOnTriggerRuntime() const {
   return on_trigger_runtime_averager_.getLastValue();
 }
 
+std::chrono::milliseconds ProcessorMetrics::getAverageSessionCommitRuntime() const {
+  return session_commit_runtime_averager_.getAverage();
+}
+
+void ProcessorMetrics::addLastSessionCommitRuntime(std::chrono::milliseconds runtime) {
+  session_commit_runtime_averager_.addValue(runtime);
+}
+
+std::chrono::milliseconds ProcessorMetrics::getLastSessionCommitRuntime() const {
+  return session_commit_runtime_averager_.getLastValue();
+}
 
 template<typename ValueType>
 requires Summable<ValueType> && DividableByInteger<ValueType>

Review Comment:
   Good catch, it was a mistake, updated in 7567374d9c44cf63b993eb76c1819ea957832e59



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] martinzink closed pull request #1477: MINIFICPP-2016 Add session commit time metrics

Posted by "martinzink (via GitHub)" <gi...@apache.org>.
martinzink closed pull request #1477: MINIFICPP-2016 Add session commit time metrics
URL: https://github.com/apache/nifi-minifi-cpp/pull/1477


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1477: MINIFICPP-2016 Add session commit time metrics

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #1477:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1477#discussion_r1087562738


##########
libminifi/test/unit/MetricsTests.cpp:
##########
@@ -246,6 +246,38 @@ TEST_CASE("Test ProcessorMetrics", "[ProcessorMetrics]") {
   metrics.addLastOnTriggerRuntime(10ms);
   REQUIRE(metrics.getLastOnTriggerRuntime() == 10ms);
   REQUIRE(metrics.getAverageOnTriggerRuntime() == 37ms);
+
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 0ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 0ms);
+
+  metrics.addLastSessionCommitRuntime(10ms);
+  metrics.addLastSessionCommitRuntime(20ms);
+  metrics.addLastSessionCommitRuntime(30ms);
+
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 30ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 20ms);
+
+  for (auto i = 0; i < 7; ++i) {
+    metrics.addLastSessionCommitRuntime(50ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 41ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 50ms);
+
+  for (auto i = 0; i < 3; ++i) {
+    metrics.addLastSessionCommitRuntime(50ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 50ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 50ms);
+
+  for (auto i = 0; i < 10; ++i) {
+    metrics.addLastSessionCommitRuntime(40ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 40ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 40ms);
+
+  metrics.addLastSessionCommitRuntime(10ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 10ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 37ms);

Review Comment:
   Updated in 7567374d9c44cf63b993eb76c1819ea957832e59



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] fgerlits commented on a diff in pull request #1477: MINIFICPP-2016 Add session commit time metrics

Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits commented on code in PR #1477:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1477#discussion_r1086575694


##########
libminifi/test/unit/MetricsTests.cpp:
##########
@@ -246,6 +246,38 @@ TEST_CASE("Test ProcessorMetrics", "[ProcessorMetrics]") {
   metrics.addLastOnTriggerRuntime(10ms);
   REQUIRE(metrics.getLastOnTriggerRuntime() == 10ms);
   REQUIRE(metrics.getAverageOnTriggerRuntime() == 37ms);
+
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 0ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 0ms);
+
+  metrics.addLastSessionCommitRuntime(10ms);
+  metrics.addLastSessionCommitRuntime(20ms);
+  metrics.addLastSessionCommitRuntime(30ms);
+
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 30ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 20ms);
+
+  for (auto i = 0; i < 7; ++i) {
+    metrics.addLastSessionCommitRuntime(50ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 41ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 50ms);
+
+  for (auto i = 0; i < 3; ++i) {
+    metrics.addLastSessionCommitRuntime(50ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 50ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 50ms);
+
+  for (auto i = 0; i < 10; ++i) {
+    metrics.addLastSessionCommitRuntime(40ms);
+  }
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 40ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 40ms);
+
+  metrics.addLastSessionCommitRuntime(10ms);
+  REQUIRE(metrics.getLastSessionCommitRuntime() == 10ms);
+  REQUIRE(metrics.getAverageSessionCommitRuntime() == 37ms);

Review Comment:
   I would put these in a separate `TEST_CASE`



##########
libminifi/src/core/ProcessorMetrics.cpp:
##########
@@ -105,6 +110,17 @@ std::chrono::milliseconds ProcessorMetrics::getLastOnTriggerRuntime() const {
   return on_trigger_runtime_averager_.getLastValue();
 }
 
+std::chrono::milliseconds ProcessorMetrics::getAverageSessionCommitRuntime() const {
+  return session_commit_runtime_averager_.getAverage();
+}
+
+void ProcessorMetrics::addLastSessionCommitRuntime(std::chrono::milliseconds runtime) {
+  session_commit_runtime_averager_.addValue(runtime);
+}
+
+std::chrono::milliseconds ProcessorMetrics::getLastSessionCommitRuntime() const {
+  return session_commit_runtime_averager_.getLastValue();
+}
 
 template<typename ValueType>
 requires Summable<ValueType> && DividableByInteger<ValueType>

Review Comment:
   at line 128, why is it safe to check `values_.empty()` outside of the lock?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org