lordgamez commented on code in PR #1909:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1909#discussion_r1916888999
##########
libminifi/src/core/state/nodes/FlowInformation.cpp:
##########
@@ -61,19 +61,42 @@ std::vector<SerializedResponseNode>
FlowInformation::serialize() {
serialized.push_back(queues);
}
+ std::unordered_map<std::string, bool> processors_running;
if (nullptr != monitor_) {
- SerializedResponseNode componentsNode{.name = "components", .collapsible =
false};
- monitor_->executeOnAllComponents([&componentsNode](StateController&
component){
- componentsNode.children.push_back({
- .name = component.getComponentName(),
+ monitor_->executeOnAllComponents([&processors_running](StateController&
component){
+ processors_running[component.getComponentUUID().to_string()] =
component.isRunning();
+ });
+ }
+
+ if (!processors_.empty()) {
+ SerializedResponseNode processorsStatusesNode{.name = "processorStatuses",
.array = true, .collapsible = false};
+ for (const auto processor : processors_) {
+ if (!processor) {
+ continue;
+ }
+
+ auto metrics = processor->getMetrics();
+ processorsStatusesNode.children.push_back({
+ .name = processor->getName(),
.collapsible = false,
.children = {
- {.name = "running", .value = component.isRunning()},
- {.name = "uuid", .value =
std::string{component.getComponentUUID().to_string()}}
+ {.name = "id", .value = std::string{processor->getUUIDStr()}},
+ {.name = "groupId", .value = processor->getProcessGroupUUIDStr()},
+ {.name = "bytesRead", .value = metrics->bytes_read.load()},
+ {.name = "bytesWritten", .value = metrics->bytes_written.load()},
+ {.name = "flowFilesIn", .value =
metrics->incoming_flow_files.load()},
+ {.name = "flowFilesOut", .value =
metrics->transferred_flow_files.load()},
+ {.name = "bytesIn", .value = metrics->incoming_bytes.load()},
+ {.name = "bytesOut", .value = metrics->transferred_bytes.load()},
+ {.name = "invocations", .value = metrics->invocations.load()},
+ {.name = "processingNanos", .value =
metrics->processing_nanos.load()},
+ {.name = "activeThreadCount", .value = -1},
+ {.name = "terminatedThreadCount", .value = -1},
+ {.name = "running", .value =
(processors_running.contains(processor->getUUIDStr()) ?
processors_running[processor->getUUIDStr()] : false)}
Review Comment:
Good catch, in that case we wouldn't need the state monitor for this
response node at all. I updated it to use this approach and also changed the
labels for the Prometheus metrics on the `is_running` metric to
`processor_name` and `processor_uuid` to be consistent with the other fields in
https://github.com/apache/nifi-minifi-cpp/pull/1909/commits/fe98dcba1ed1a3f584766618625a5efd3e369189
--
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]