szaszm commented on code in PR #1340:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1340#discussion_r892504581
##########
libminifi/include/core/state/nodes/QueueMetrics.h:
##########
@@ -94,15 +82,20 @@ class QueueMetrics : public ResponseNode {
return serialized;
}
- protected:
- std::map<std::string, std::unique_ptr<minifi::Connection>> connections;
+ std::vector<PublishedMetric> calculateMetrics() override {
+ std::vector<PublishedMetric> metrics;
+ for (const auto& [_, connection] : connections_) {
+ metrics.push_back({"queue_data_size",
static_cast<double>(connection->getQueueDataSize()),
+ {{"connection_uuid", connection->getUUIDStr()}, {"connection_name",
connection->getName()}, {"metric_class", getName()}}});
+ metrics.push_back({"queue_data_size_max",
static_cast<double>(connection->getMaxQueueDataSize()),
+ {{"connection_uuid", connection->getUUIDStr()}, {"connection_name",
connection->getName()}, {"metric_class", getName()}}});
+ metrics.push_back({"queue_size",
static_cast<double>(connection->getQueueSize()),
+ {{"connection_uuid", connection->getUUIDStr()}, {"connection_name",
connection->getName()}, {"metric_class", getName()}}});
+ metrics.push_back({"queue_size_max",
static_cast<double>(connection->getMaxQueueSize()),
+ {{"connection_uuid", connection->getUUIDStr()}, {"connection_name",
connection->getName()}, {"metric_class", getName()}}});
+ }
+ return metrics;
Review Comment:
It would be nice if the Prometheus publisher could take the structured data
from FlowInformation and flatten it to the Prometheus-friendly format
internally.
--
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]