Skip to content

Commit

Permalink
Handle NullPointerException for getAttributes (#444)
Browse files Browse the repository at this point in the history
* If a mBean's attributes are null, log it out for debugging.

Signed-off-by: Matt Russi <mattrussi@users.noreply.github.com>
  • Loading branch information
mattrussi authored and brian-brazil committed Oct 23, 2019
1 parent a46db5a commit db8b6a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions collector/src/main/java/io/prometheus/jmx/JmxScraper.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ private void scrapeBean(MBeanServerConnection beanConn, ObjectName mbeanName) {
final AttributeList attributes;
try {
attributes = beanConn.getAttributes(mbeanName, name2AttrInfo.keySet().toArray(new String[0]));
if (attributes == null) {
logScrape(mbeanName.toString(), "getAttributes Fail: attributes are null");
return;
}
} catch (Exception e) {
logScrape(mbeanName, name2AttrInfo.keySet(), "Fail: " + e);
return;
Expand Down

0 comments on commit db8b6a8

Please sign in to comment.