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

Removes periodic re-init of statsd reporter #422

Merged
merged 1 commit into from
Nov 10, 2023
Merged
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
12 changes: 0 additions & 12 deletions src/main/java/org/datadog/jmxfetch/reporter/StatsdReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class StatsdReporter extends Reporter {
private int statsdPort;
private Boolean telemetry;
private int queueSize;
private long initializationTime;
private boolean nonBlocking;
private int socketBufferSize;
private int socketTimeout;
Expand All @@ -37,8 +36,6 @@ public StatsdReporter(String statsdHost, int statsdPort, boolean telemetry, int
}

private void init() {
initializationTime = System.currentTimeMillis();

// Only set the entityId to "none" if UDS communication is activated
String entityId = this.statsdPort == 0 ? "none" : null;
int defaultUdsDatagramSize = 8192;
Expand Down Expand Up @@ -99,10 +96,6 @@ private void init() {

protected void sendMetricPoint(
String metricType, String metricName, double value, String[] tags) {
if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) {
this.statsDClient.stop();
init();
}
if (metricType.equals("monotonic_count")) {
statsDClient.count(metricName, (long) value, tags);
} else if (metricType.equals("histogram")) {
Expand All @@ -115,11 +108,6 @@ protected void sendMetricPoint(
/** Submits service check. */
public void doSendServiceCheck(
String serviceCheckName, String status, String message, String[] tags) {
if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) {
this.statsDClient.stop();
init();
}

ServiceCheck sc = ServiceCheck.builder()
.withName(serviceCheckName)
.withStatus(this.statusToServiceCheckStatus(status))
Expand Down
Loading