From fbfe11b8083c71dc8ad4382120de0cd82a113a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Onuki?= Date: Tue, 5 Nov 2024 09:58:42 -0500 Subject: [PATCH] SpanEventFactory - adding null check on server port (#2127) --- .../newrelic/agent/service/analytics/SpanEventFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/newrelic-agent/src/main/java/com/newrelic/agent/service/analytics/SpanEventFactory.java b/newrelic-agent/src/main/java/com/newrelic/agent/service/analytics/SpanEventFactory.java index 1d96aa63ff..61efd37791 100644 --- a/newrelic-agent/src/main/java/com/newrelic/agent/service/analytics/SpanEventFactory.java +++ b/newrelic-agent/src/main/java/com/newrelic/agent/service/analytics/SpanEventFactory.java @@ -320,8 +320,10 @@ public SpanEventFactory setMessagingDestination(String messagingDestination) { return this; } - public SpanEventFactory setServerPort(int port) { - builder.putAgentAttribute(AttributeNames.SERVER_PORT, port); + public SpanEventFactory setServerPort(Integer port) { + if (port != null) { + builder.putAgentAttribute(AttributeNames.SERVER_PORT, port); + } return this; }