From a140bb6cfe9cdea77e52401cd175f23e25b94b39 Mon Sep 17 00:00:00 2001 From: Jason Keller Date: Mon, 6 Jan 2025 14:26:48 -0800 Subject: [PATCH] Don't add null port to hostname attribute on JFR events --- .../src/main/java/com/newrelic/agent/jfr/JfrService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/newrelic-agent/src/main/java/com/newrelic/agent/jfr/JfrService.java b/newrelic-agent/src/main/java/com/newrelic/agent/jfr/JfrService.java index 36274ed4e7..7b96905898 100644 --- a/newrelic-agent/src/main/java/com/newrelic/agent/jfr/JfrService.java +++ b/newrelic-agent/src/main/java/com/newrelic/agent/jfr/JfrService.java @@ -136,7 +136,11 @@ private String getHostname() { logger.error(e.getMessage()); host = InetAddress.getLoopbackAddress().getHostAddress(); } - return String.format("%s:%s", host, appPort); + if (appPort != null) { + return String.format("%s:%s", host, appPort); + } else { + return host; + } } @VisibleForTesting