fix: add remote service name to server trace

pull/1664/head
shedfreewu 2 months ago
parent c74499c235
commit e570c73b34

@ -20,6 +20,7 @@ package com.tencent.cloud.plugin.trace.attribute;
import java.util.HashMap;
import java.util.Map;
import com.tencent.cloud.common.constant.MetadataConstant;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.rpc.enhancement.plugin.EnhancedPluginContext;
@ -59,6 +60,9 @@ public class PolarisSpanAttributesProvider implements SpanAttributesProvider {
if (CollectionUtils.isNotEmpty(upstreamDisposableCustomAttributes)) {
for (Map.Entry<String, String> entry : upstreamDisposableCustomAttributes.entrySet()) {
attributes.put("custom." + entry.getKey(), entry.getValue());
if (MetadataConstant.DefaultMetadata.DEFAULT_METADATA_SOURCE_SERVICE_NAME.equals(entry.getKey())) {
attributes.put("net.peer.service", entry.getValue());
}
}
}
attributes.put("http.port", CalleeMetadataContainerGroup.getStaticApplicationMetadataContainer()

Loading…
Cancel
Save