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/11/02 10:01:16 UTC

[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1438: MINIFICPP-1966 Add AgentStatus to Prometheus metrics

lordgamez commented on code in PR #1438:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1438#discussion_r1011500001


##########
libminifi/include/core/state/nodes/AgentInformation.h:
##########
@@ -444,6 +452,37 @@ class AgentStatus : public StateMonitorNode {
     return serialized;
   }
 
+  std::vector<PublishedMetric> calculateMetrics() override {
+    std::vector<PublishedMetric> metrics;
+    for (const auto& [_, repo] : repositories_) {
+      metrics.push_back({"is_running", (repo->isRunning() ? 1.0 : 0.0), {{"metric_class", getName()}, {"repository_name", repo->getName()}}});
+      metrics.push_back({"is_full", (repo->isFull() ? 1.0 : 0.0), {{"metric_class", getName()}, {"repository_name", repo->getName()}}});
+      metrics.push_back({"repository_size", static_cast<double>(repo->getRepoSize()), {{"metric_class", getName()}, {"repository_name", repo->getName()}}});
+    }
+    uint64_t uptime = 0;
+    if (nullptr != monitor_) {
+      uptime = monitor_->getUptime();
+    }
+    metrics.push_back({"uptime_milliseconds", static_cast<double>(uptime), {{"metric_class", getName()}}});

Review Comment:
   I agree it's better not to report this metric when not available, updated in a3cb92d9086aaf04386658f66d072bbb27d85395



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