-
Notifications
You must be signed in to change notification settings - Fork 70
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
Limit MBeans query to certain scopes #63
Conversation
JMXFetch is currently fetching all available beans regardless of the user configuration. This might cause a high memory load when the application is exposing a lot of metrics (thus OOM issues). This change is the first step towards a bigger JMXFetch memory consumption improvement: the idea is to find, among the user defined beans, some common patterns to limit the scopes to query. For instance, ``` - org.datadog.jmxfetch.test:scope=sameScope,param=sameParam,type=sameType - org.datadog.jmxfetch.test:scope=sameScope,param=notTheSameParam,type=sameType ``` would induce a query on "org.datadog.jmxfetch.test:scope=sameScope,type=sameType,*" instead of "*:*". At the moment, only one scope per domain name is computed: it's kind of the greatest common divisor/pattern of the beans. Ideally, this should be improved to recognize multiple scopes among the same domain name.
} | ||
} | ||
catch (Exception e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a nitpick, but could we also log an error so that the exception is not completely silent when JMXFetch's stderr is not redirected to a log?
Something like LOGGER.error("Unable to compute common bean scope, querying all beans as a fallback")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not a nitpick and it would be better to catch a more specific exception)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
Otherwise I can't think of a specific exception that i want to catch. I added this very generic try {} catch(){}
statement in order to fallback in the previous behavior in case anything was turning wrong. I should maybe remove it completely.
Looks great! 👍 Nothing really important in my comments except for the exception thing. |
Log common scope computing exceptions. Improve the code readability.
Thanks for the feedback. This closes the JMXFetch v0.8.0 release: I'll write the CHANGELOG and submit the new artifact to dd-agent. |
Limit MBeans query to certain scopes
Do not scope MBeans queries on `list_everything` or `list_not_matching_attributes`. Fix regression introduced with #63.
Do not scope MBeans queries on `list_everything` or `list_not_matching_attributes`. Fix regression introduced with #63.
JMXFetch is currently fetching all available beans regardless of the
user configuration. This might cause a high memory load when the
application is exposing a lot of metrics (thus OOM issues).
This change is the first step towards a bigger JMXFetch memory
consumption improvement: the idea is to find, among the user defined
beans, some common patterns to limit the scopes to query.
For instance,
would induce a query on
org.datadog.jmxfetch.test:scope=sameScope,type=sameType,*
instead of
*:*
.At the moment, only one scope per domain name is computed: it's kind of
the greatest common divisor/pattern of the beans.
Ideally, this should be improved to recognize multiple scopes among the
same domain name.