The way by plugin to receive internal state/ statistics can be done through implementing MetricsSink interface and register sink to the MetricsSystem. The metrics system will periodically harvests internal state from source, which implements MetricsSource, putting it to sink. For example, at the moment there is a JvmMetrics which records java vm related information; therefore, by registering a sink one can obtain jvm statistics periodically.
This seems to me correspond to the behaviour in use case explained in your comment. For monitoring network connection, an instance of network MetricsSource can be added to the metrics system beforehand, and a sink can be implemented for receiving related statistics such as source and dest value, etc. But there may have something I miss or I am not aware of due to my limited knowledge. Any chance you can help point out if something is missing in the current system?
Thank you for the feedback. It is very important to know actual user scenarios for improvement.