Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: add support for attribute regex #148

Open
sv3ndk opened this issue Jul 21, 2017 · 0 comments
Open

Improvement: add support for attribute regex #148

sv3ndk opened this issue Jul 21, 2017 · 0 comments

Comments

@sv3ndk
Copy link

sv3ndk commented Jul 21, 2017

Hi all,

What

I'd like to suggest to add support for MBean attribute's name regex, in the same fashion as the current domain_regex and bean_regex.

The desired behaviour would be that any attribute matching the regex would be included in list of matchingAttributes and tags would be attached to specify the matched value (as for bean_regex)

Why

Some Mbeans expose a variable set of attributes whose name contain information about what is being monitored.

My primary interest here is to be able to monitor Kafka's consumer lag. Kafka consumers expose one MBean for each client id and provide this lag for each partition of each topic they consume with as many MBean attributes, following this naming pattern: {topic}-{partition}.records-lag. See kafka 0.11 consumer monitoring documentation for more details.

In the jconsole, that MBean looks like this:

image

How

The selection of MBean attributes to monitor is happening in this if statement of Instance.getMatchingAtrributes(), which ultimately delegates to either JMXSimpleAttribute.matchAttribute(), JMXComplexAttribute.matchAttribute() or JMXTabularAttribute.

I suggest to refactor those three in order to support matching based on regex.

I also suggest to update SimpleAttribute.addAdditionalTag() to add tags to document the matched value (in my kafka example: the topic name and partition number).

In order to populate those tags we need to have a tag name. I suggest to allow the user to specify them as part of the regex, as documented here in the java 7 regex documentation.

Who

I'm happy to start working on this and submit a PR if the approach above sounds ok to you.

What do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant