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

Upgrade java-dogstatsd-client to 2.7 #207

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<commons-lang.version>2.6</commons-lang.version>
<apache-commons-lang3.version>3.5</apache-commons-lang3.version>
<guava.version>17.0</guava.version>
<java-dogstatsd-client.version>2.1.0</java-dogstatsd-client.version>
<java-dogstatsd-client.version>2.7</java-dogstatsd-client.version>
<jcommander.version>1.35</jcommander.version>
<log4j.version>1.2.17</log4j.version>
<jackson.version>2.9.8</jackson.version>
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/org/datadog/jmxfetch/reporter/StatsdReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ protected void sendMetricPoint(
}
}

private int statusToInt(String status) {
private ServiceCheck.Status statusToServiceCheckStatus(String status) {
if (status == Status.STATUS_OK) {
return 0;
return ServiceCheck.Status.OK;
} else if (status == Status.STATUS_WARNING) {
return 1;
return ServiceCheck.Status.WARNING;
} else if (status == Status.STATUS_ERROR) {
// critical
return 2;
return ServiceCheck.Status.CRITICAL;
}
return 3;
return ServiceCheck.Status.UNKNOWN;
}

/** Submits service check. */
Expand All @@ -63,12 +62,13 @@ public void doSendServiceCheck(String checkName, String status, String message,
init();
}

ServiceCheck sc =
new ServiceCheck(
String.format("%s.can_connect", checkName),
this.statusToInt(status),
message,
tags);
ServiceCheck sc = ServiceCheck.builder()
.withName(String.format("%s.can_connect", checkName))
.withStatus(this.statusToServiceCheckStatus(status))
.withMessage(message)
.withTags(tags)
.build();

statsDClient.serviceCheck(sc);
}

Expand Down