The MetricsSource operator calls retrieveMetrics on operator, port, or PE MxBean objects to get the corresponding metrics according to the specified filters. This might result in a huge amount of JMX calls, depending on the criteria in the filter document and the size of the monitored applications.
For some use cases, it might be useful to use snapshotMetrics instead of retrieveMetrics. snapshotMetrics can be called on instance, job, or PE MxBean objects. The returned URL is used to get all metrics via an HTTP GET request. The advantage is the significantly reduced number of JMX calls, the disadvantage is the probably larger amount of data that is returned and which requires JSON parsing.
Some code for snapshotMetrics is available as comment from earlier prototyping. Also the JmxTrustManager is available. Its code is copied from here. It might be necessary to implement additional security features into the trust manager.
So far, snapshotMetrics returns all available metrics, but this might change in the future, for example, filters might be supported. If filters are supported, it has to be evaluated whether they match to the regex syntax and features of the filter document, and whether they can be used to reduce the number of JMX calls.
So far, I recommend to introduce a parameter that allows switching between snapshotMetrics and retrieveMetrics mode.
The MetricsSource operator calls retrieveMetrics on operator, port, or PE MxBean objects to get the corresponding metrics according to the specified filters. This might result in a huge amount of JMX calls, depending on the criteria in the filter document and the size of the monitored applications.
For some use cases, it might be useful to use snapshotMetrics instead of retrieveMetrics. snapshotMetrics can be called on instance, job, or PE MxBean objects. The returned URL is used to get all metrics via an HTTP GET request. The advantage is the significantly reduced number of JMX calls, the disadvantage is the probably larger amount of data that is returned and which requires JSON parsing.
Some code for snapshotMetrics is available as comment from earlier prototyping. Also the JmxTrustManager is available. Its code is copied from here. It might be necessary to implement additional security features into the trust manager.
So far, snapshotMetrics returns all available metrics, but this might change in the future, for example, filters might be supported. If filters are supported, it has to be evaluated whether they match to the regex syntax and features of the filter document, and whether they can be used to reduce the number of JMX calls.
So far, I recommend to introduce a parameter that allows switching between snapshotMetrics and retrieveMetrics mode.