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

Remove messages for non-ERROR can_connect service checks #369

Merged
merged 4 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/org/datadog/jmxfetch/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,11 @@ private void sendServiceCheck(
private void sendCanConnectServiceCheck(Reporter reporter, String checkName,
String serviceCheckPrefix, String status, String message, String[] tags) {
String serviceCheckName = String.format("%s.can_connect", serviceCheckPrefix);

if (status != Status.STATUS_ERROR) {
yzhan289 marked this conversation as resolved.
Show resolved Hide resolved
message = null;
}

reporter.sendServiceCheck(
checkName, serviceCheckName, status, message, tags);
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/datadog/jmxfetch/TestServiceChecks.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ public void testServiceCheckWarning() throws Exception {
assertNotNull(sc.get("name"));
assertNotNull(sc.get("status"));

// Message should not be null anymore and reports a high number of metrics warning
assertNotNull(sc.get("message"));
// Despite there being a high number of metrics warning, message should be null.
// Non-ERROR statuses are set to OK, and OK statuses should have null messages.
assertNull(sc.get("message"));
assertNotNull(sc.get("tags"));

String scName = (String) (sc.get("name"));
Expand Down