From 25ff2242ec066d769ce17fa92b80839589c68978 Mon Sep 17 00:00:00 2001 From: Andrea Marziali Date: Mon, 9 Dec 2024 09:13:00 +0100 Subject: [PATCH] Adjust service name for non legacy tracing --- .../java/datadog/trace/api/naming/v0/MessagingNamingV0.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal-api/src/main/java/datadog/trace/api/naming/v0/MessagingNamingV0.java b/internal-api/src/main/java/datadog/trace/api/naming/v0/MessagingNamingV0.java index fe4b3bef3c38..d8b2991ed9b4 100644 --- a/internal-api/src/main/java/datadog/trace/api/naming/v0/MessagingNamingV0.java +++ b/internal-api/src/main/java/datadog/trace/api/naming/v0/MessagingNamingV0.java @@ -1,6 +1,7 @@ package datadog.trace.api.naming.v0; import datadog.trace.api.Config; +import datadog.trace.api.naming.ClassloaderServiceNames; import datadog.trace.api.naming.NamingSchema; import datadog.trace.api.remoteconfig.ServiceNameCollector; import javax.annotation.Nonnull; @@ -46,6 +47,11 @@ public String inboundService(@Nonnull final String messagingSystem, boolean useL ServiceNameCollector.get().addService(messagingSystem); return messagingSystem; } else { + final String contextual = ClassloaderServiceNames.maybeGetForThread(Thread.currentThread()); + if (contextual != null) { + ServiceNameCollector.get().addService(contextual); + return contextual; + } return Config.get().getServiceName(); } } else {