IBMStreams / streamsx.monitoring

The com.ibm.streamsx.monitoring toolkit provides capabilities to create applications that monitor IBM Streams and its applications.
https://ibmstreams.github.io/streamsx.monitoring/
Other
5 stars 5 forks source link

MetricsSource: Support snapshotMetrics in addition to retrieveMetrics #29

Closed m-kotowski closed 5 years ago

m-kotowski commented 7 years ago

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.

markheger commented 5 years ago

not required