Skip to content

Commit

Permalink
Fixes divide by zero bug introduced in previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell committed Dec 27, 2023
1 parent c118cc2 commit ea0bf5b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/org/datadog/jmxfetch/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,6 @@ private synchronized int addMatchingAttributesForBean(
e);
}
}
// TODO if there was a matching conf, then we must return
// true so that the instanceTelemetryBeanRatio can be kept correctly
// ref: jmxfetch pr 487

if (jmxAttribute.getMatchingConf() == null
&& (action.equals(AppConfig.ACTION_LIST_EVERYTHING)
Expand Down Expand Up @@ -763,7 +760,7 @@ private void getMatchingAttributes() throws IOException {
}
}

if (instanceTelemetryBean != null) {
if (instanceTelemetryBean != null && beans.size() > 0) {
instanceTelemetryBean.setBeanMatchRatio(beansWithAttributeMatch / beans.size());
}

Expand Down

0 comments on commit ea0bf5b

Please sign in to comment.