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/10/27 12:39:30 UTC

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

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


##########
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:
   do we really want to publish "uptime = 0" when the uptime is not available?



##########
METRICS.md:
##########
@@ -159,3 +159,25 @@ DeviceInfoNode is a system level metric that reports metrics about the system re
 | connection_name | Name of the connection defined in the flow configuration     |
 | component_uuid  | UUID of the component                                        |
 | component_name  | Name of the component                                        |
+
+### AgentStatus
+
+AgentStatus is a system level metric that defines current agent status including repository, component and resource usage information.
+
+| Metric name              | Labels                         | Description                                            |
+|--------------------------|--------------------------------|--------------------------------------------------------|
+| is_running               | repository_name                | Is the repository running (1 or 0)                     |
+| is_full                  | repository_name                | Is the repository full (1 or 0)                        |
+| repository_size          | repository_name                | Current size of the repository                         |
+| uptime_milliseconds      | -                              | Agent uptime in milliseconds                           |
+| is_running               | component_uuid, component_name | Check if the component is running (1 or 0)             |
+| agent_memory_usage_bytes | -                              | Memory used by the agent process in bytes              |
+| agent_cpu_utilization    | -                              | CPU utilization of the agent process (between 0 and 1) |

Review Comment:
   do we want to mention here that `agent_cpu_utilization` can be -1 in case of errors, or are we confident that will never happen?



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