bakaid commented on a change in pull request #743: Minificpp 1169 - Simplify C2
metrics collection and reporting
URL: https://github.com/apache/nifi-minifi-cpp/pull/743#discussion_r388296214
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -916,57 +916,37 @@ int16_t FlowController::clearConnection(const
std::string &connection) {
return -1;
}
-int16_t
FlowController::getResponseNodes(std::vector<std::shared_ptr<state::response::ResponseNode>>
&metric_vector, uint16_t metricsClass) {
+std::shared_ptr<state::response::ResponseNode>
FlowController::getMetricsNode() const {
std::lock_guard<std::mutex> lock(metrics_mutex_);
-
- for (auto metric : root_response_nodes_) {
- metric_vector.push_back(metric.second);
+ const auto iter = root_response_nodes_.find("metrics");
+ if (iter != root_response_nodes_.end()) {
+ return iter->second;
}
-
- return 0;
+ return nullptr;
}
-int16_t
FlowController::getMetricsNodes(std::vector<std::shared_ptr<state::response::ResponseNode>>
&metric_vector, uint16_t metricsClass) {
- std::lock_guard<std::mutex> lock(metrics_mutex_);
- if (metricsClass == 0) {
- for (auto metric : device_information_) {
- metric_vector.push_back(metric.second);
- }
- } else {
- auto metrics = component_metrics_by_id_[metricsClass];
- for (const auto &metric : metrics) {
- metric_vector.push_back(metric);
- }
- }
- return 0;
-}
+std::vector<std::shared_ptr<state::response::ResponseNode>>
FlowController::getHeartbeatNodes(bool includeManifest) const {
+ std::string fullHb{"true"};
+ configuration_->get("nifi.c2.full.heartbeat", fullHb);
Review comment:
In some ideal future state I would be more happy if the ResponseNodes
themselves would be initialized with the configuration and could decide
themselves what to based on it, but I do think this is a big step in the right
direction, as it eliminates the class duplication and makes "communication"
with the ResponseNode 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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services