From 93203b06969d470e9f31980bff2096b0d6c361ba Mon Sep 17 00:00:00 2001 From: Gabor Gyimesi Date: Tue, 10 Dec 2024 17:15:26 +0100 Subject: [PATCH] Add process group id to processor --- libminifi/include/core/Processor.h | 10 ++++++++++ libminifi/src/core/ProcessGroup.cpp | 1 + libminifi/src/core/state/nodes/FlowInformation.cpp | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libminifi/include/core/Processor.h b/libminifi/include/core/Processor.h index 6f25c176c3..8dfc3db778 100644 --- a/libminifi/include/core/Processor.h +++ b/libminifi/include/core/Processor.h @@ -165,6 +165,14 @@ class Processor : public Connectable, public ConfigurableComponent, public state active_tasks_ = 0; } + std::string getProcessGroupUUIDStr() const { + return process_group_uuid_; + } + + void setProcessGroupUUIDStr(const std::string &uuid) { + process_group_uuid_ = uuid; + } + void yield() override; void yield(std::chrono::steady_clock::duration delta_time); @@ -256,6 +264,8 @@ class Processor : public Connectable, public ConfigurableComponent, public state // an outgoing connection allows us to reach these nodes std::unordered_map> reachable_processors_; + + std::string process_group_uuid_; }; } // namespace core diff --git a/libminifi/src/core/ProcessGroup.cpp b/libminifi/src/core/ProcessGroup.cpp index 7fdcf175d9..fcf916ceb1 100644 --- a/libminifi/src/core/ProcessGroup.cpp +++ b/libminifi/src/core/ProcessGroup.cpp @@ -86,6 +86,7 @@ std::tuple ProcessGroup::addProcessor(std::unique_ptrgetName(); std::lock_guard lock(mutex_); + processor->setProcessGroupUUIDStr(getUUIDStr()); const auto [iter, inserted] = processors_.insert(std::move(processor)); if (inserted) { logger_->log_debug("Add processor {} into process group {}", name, name_); diff --git a/libminifi/src/core/state/nodes/FlowInformation.cpp b/libminifi/src/core/state/nodes/FlowInformation.cpp index 350f7cfd66..00cfb0eb92 100644 --- a/libminifi/src/core/state/nodes/FlowInformation.cpp +++ b/libminifi/src/core/state/nodes/FlowInformation.cpp @@ -89,7 +89,7 @@ std::vector FlowInformation::serialize() { .collapsible = false, .children = { {.name = "id", .value = std::string{processor->getUUIDStr()}}, - // {.name = "groupId", .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()},