Avoid setting hostname tag on local root span if empty
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/Config.java
dd-trace-api/src/main/java/datadog/trace/api/Config.java
@@ -323,12 +323,21 @@ public class Config {
/** @return A map of tags to be applied only to the local application root span. */
public Map<String, String> getLocalRootSpanTags() {
final Map<String, String> runtimeTags = getRuntimeTags();
+
+ String hostname = "";
+ if (reportHostName) {
+ hostname = getHostname();
+ }
+ boolean shouldReportHostName = null != hostname && !hostname.isEmpty();
+
final Map<String, String> result =
- newHashMap(reportHostName ? (runtimeTags.size() + 1) : runtimeTags.size());
+ newHashMap(shouldReportHostName ? (runtimeTags.size() + 1) : runtimeTags.size());
result.putAll(runtimeTags);
- if (reportHostName) {
+
+ if (shouldReportHostName) {
result.put(INTERNAL_HOST_NAME, getHostname());
}
+
return Collections.unmodifiableMap(result);
}

Avoid setting hostname tag on local root span if empty