From 4508daca27ceae6a753a9e2f1fc1020336091adf Mon Sep 17 00:00:00 2001 From: Yury Gribkov Date: Fri, 6 Dec 2024 16:59:08 -0800 Subject: [PATCH 1/2] Mute JMXFetch Shutdown in progress error --- .../java/datadog/trace/agent/jmxfetch/JMXFetch.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java index 4647042a266..b7dd39d2b2e 100644 --- a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java +++ b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java @@ -142,9 +142,16 @@ public void run() { if (!appConfig.getExitWatcher().shouldExit()) { try { final int result = app.run(); - log.error("jmx collector exited with result: {}", result); + if (result != 0) { + log.error("jmx collector exited with result: {}", result); + } } catch (final Exception e) { - log.error("Exception in jmx collector thread", e); + String message = e.getMessage(); + boolean ignoredException = + message != null && message.startsWith("Shutdown in progress"); + if (!ignoredException) { + log.error("Exception in jmx collector thread", e); + } } } // always wait before next attempt From 5019d476d27d7186495f1f8c324ef41e08976359 Mon Sep 17 00:00:00 2001 From: Yury Gribkov Date: Wed, 8 Jan 2025 10:22:31 -0800 Subject: [PATCH 2/2] Log warn instead of error for jmx collector error --- .../src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java index b7dd39d2b2e..d81415a7d68 100644 --- a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java +++ b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java @@ -143,14 +143,14 @@ public void run() { try { final int result = app.run(); if (result != 0) { - log.error("jmx collector exited with result: {}", result); + log.warn("jmx collector exited with error code: {}", result); } } catch (final Exception e) { String message = e.getMessage(); boolean ignoredException = message != null && message.startsWith("Shutdown in progress"); if (!ignoredException) { - log.error("Exception in jmx collector thread", e); + log.warn("Exception in jmx collector thread", e); } } }