From 23066ff6ce0da480f7c0dd4bcde8095643ee8954 Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Tue, 6 Mar 2018 21:30:50 -0500 Subject: [PATCH 1/5] Add read timeout for how long we query beans --- src/main/java/org/datadog/jmxfetch/RemoteConnection.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java index a1ccec5f4..405a0b97e 100644 --- a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java +++ b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java @@ -20,6 +20,7 @@ public class RemoteConnection extends Connection { private String jmx_url; private static final String TRUST_STORE_PATH_KEY = "trust_store_path"; private static final String TRUST_STORE_PASSWORD_KEY = "trust_store_password"; + private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "5000"; private final static Logger LOGGER = Logger.getLogger(Connection.class.getName()); public RemoteConnection(LinkedHashMap connectionParams) @@ -53,6 +54,10 @@ public RemoteConnection(LinkedHashMap connectionParams) } } + + //Set an RMI timeout so we don't get stuck waiting for a bean to report a value + System.setProperty("sun.rmi.transport.tcp.responseTimeout", DEFAULT_RMI_RESPONSE_TIMEOUT); + createConnection(); } From 31d8e921d872b563c141103e10de6a827c6ae106 Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Wed, 7 Mar 2018 10:55:49 -0500 Subject: [PATCH 2/5] Changes default to 15 and tries to use refresh bean as refresh period --- src/main/java/org/datadog/jmxfetch/RemoteConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java index 405a0b97e..99914ced3 100644 --- a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java +++ b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java @@ -18,9 +18,10 @@ public class RemoteConnection extends Connection { private String password; private String path = "jmxrmi"; private String jmx_url; + private String rmi_timeout; private static final String TRUST_STORE_PATH_KEY = "trust_store_path"; private static final String TRUST_STORE_PASSWORD_KEY = "trust_store_password"; - private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "5000"; + private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "15000"; private final static Logger LOGGER = Logger.getLogger(Connection.class.getName()); public RemoteConnection(LinkedHashMap connectionParams) @@ -34,6 +35,10 @@ public RemoteConnection(LinkedHashMap connectionParams) user = (String) connectionParams.get("user"); password = (String) connectionParams.get("password"); jmx_url = (String) connectionParams.get("jmx_url"); + rmi_timeout = (String) connectionParams.get("refresh_beans"); + if (rmi_timeout == null) { + rmi_timeout = DEFAULT_RMI_RESPONSE_TIMEOUT; + } if (connectionParams.containsKey("path")){ path = (String) connectionParams.get("path"); } From c477c87bd3bf19783b2bbe7a3d5d4cb73ddfd9b2 Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Wed, 7 Mar 2018 10:58:49 -0500 Subject: [PATCH 3/5] Use the new value --- src/main/java/org/datadog/jmxfetch/RemoteConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java index 99914ced3..c43123066 100644 --- a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java +++ b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java @@ -61,7 +61,7 @@ public RemoteConnection(LinkedHashMap connectionParams) } //Set an RMI timeout so we don't get stuck waiting for a bean to report a value - System.setProperty("sun.rmi.transport.tcp.responseTimeout", DEFAULT_RMI_RESPONSE_TIMEOUT); + System.setProperty("sun.rmi.transport.tcp.responseTimeout", rmi_timeout); createConnection(); From 647736b9e3975f93dbb16fdd1e233324078d20bf Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Wed, 7 Mar 2018 11:31:05 -0500 Subject: [PATCH 4/5] Update timeout to be that of the refresh_bean default --- src/main/java/org/datadog/jmxfetch/RemoteConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java index c43123066..c6d45f5e4 100644 --- a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java +++ b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java @@ -21,7 +21,7 @@ public class RemoteConnection extends Connection { private String rmi_timeout; private static final String TRUST_STORE_PATH_KEY = "trust_store_path"; private static final String TRUST_STORE_PASSWORD_KEY = "trust_store_password"; - private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "15000"; + private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "600000"; //Match the refresh_beans default private final static Logger LOGGER = Logger.getLogger(Connection.class.getName()); public RemoteConnection(LinkedHashMap connectionParams) From 25b7061efdd22ff5d940c450319effe0366ab8be Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Wed, 7 Mar 2018 13:15:22 -0500 Subject: [PATCH 5/5] Uses its own yaml parameter, defaults back 15 seconds --- .../java/org/datadog/jmxfetch/RemoteConnection.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java index c6d45f5e4..7899d41d9 100644 --- a/src/main/java/org/datadog/jmxfetch/RemoteConnection.java +++ b/src/main/java/org/datadog/jmxfetch/RemoteConnection.java @@ -21,7 +21,7 @@ public class RemoteConnection extends Connection { private String rmi_timeout; private static final String TRUST_STORE_PATH_KEY = "trust_store_path"; private static final String TRUST_STORE_PASSWORD_KEY = "trust_store_password"; - private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "600000"; //Match the refresh_beans default + private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "15000"; //Match the collection period default private final static Logger LOGGER = Logger.getLogger(Connection.class.getName()); public RemoteConnection(LinkedHashMap connectionParams) @@ -35,10 +35,10 @@ public RemoteConnection(LinkedHashMap connectionParams) user = (String) connectionParams.get("user"); password = (String) connectionParams.get("password"); jmx_url = (String) connectionParams.get("jmx_url"); - rmi_timeout = (String) connectionParams.get("refresh_beans"); - if (rmi_timeout == null) { - rmi_timeout = DEFAULT_RMI_RESPONSE_TIMEOUT; - } + rmi_timeout = (String) connectionParams.get("rmi_client_timeout"); + if (rmi_timeout == null) { + rmi_timeout = DEFAULT_RMI_RESPONSE_TIMEOUT; + } if (connectionParams.containsKey("path")){ path = (String) connectionParams.get("path"); }