Beanshell support to extend value field functionality #619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @fstab and @tomwilkie,
This PR aims to add beanshell support for the jmx-exporter in order to enable the use of java-like code in the value field. This should make it possible to extract useful metrics out of exported MBeans, where the desired value is not of type boolean or cannot be matched against directly via different patterns, like values of type String and Array. An example of our use case is given below.
Our use case:
At EMnify we use the akka framework, which exports the number of unreachable nodes in a cluster as a list of comma separated addresses and the exported MBean is of type String. It would be very useful for monitoring, if we could see the number of unreachable nodes at any point in time. To get the length of the list, one pattern for each possible list-length is needed, with a hard-coded value corresponding to the length. Since the length of the list is not known, it is very cumbersome to keep adding patterns if more nodes join the cluster.
With these changes it should be possible to write something like:
Instead of:
As far as we tested, the changes are backwards-compatible which means users could keep using the syntax they already know.
Regards,
Csaba