szaszm 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_r390477569
##########
File path: libminifi/include/FlowController.h
##########
@@ -304,23 +305,23 @@ class FlowController : public
core::controller::ControllerServiceProvider, publi
virtual void enableAllControllerServices();
/**
- * Retrieves all root response nodes from this source.
- * @param metric_vector -- metrics will be placed in this vector.
- * @return result of the get operation.
- * 0 Success
- * 1 No error condition, but cannot obtain lock in timely manner.
- * -1 failure
+ * Retrieves metrics node
+ * @return metrics response node
*/
- virtual int16_t
getResponseNodes(std::vector<std::shared_ptr<state::response::ResponseNode>>
&metric_vector, uint16_t metricsClass);
+ virtual std::shared_ptr<state::response::ResponseNode> getMetricsNode()
const;
+
+ /**
+ * Retrieves root nodes configured to be included in heartbeat
+ * @param includeManifest -- determines if manifest is to be included
+ * @return a list of response nodes
+ */
+ virtual std::vector<std::shared_ptr<state::response::ResponseNode>>
getHeartbeatNodes(bool includeManifest) const;
Review comment:
(response to @arpadboda)
I think `root_response_nodes_` owns the objects and this function shares
this ownership with the callers. Whether this shared ownership is needed or not
is not clear to me.
We can definitely not use `unique_ptr`s for the returned pointers here, as
ownership belongs to `root_response_nodes_`, but we could maybe use
`state::response::ResponseNode*` (i.e. observer ptr) if the lifetime of the
nodes don't necessitate shared ownership.
Additionally, `root_response_nodes_` is protected, which means it's part of
our API and contains `shared_ptr`s, so we're not going to get `unique_ptr`s
there.
----------------------------------------------------------------
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