From f59e820c73ada3b772d35e69edd356c1f6ae236f Mon Sep 17 00:00:00 2001 From: Haotian Zhang Date: Tue, 10 Dec 2024 15:11:46 +0800 Subject: [PATCH] fix:fix caller disposable metadata handle when using tracing. (#1483) --- CHANGELOG.md | 1 + .../tencent/cloud/common/metadata/MetadataContextHolder.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2bb1e4fb..480fe1f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,3 +42,4 @@ - [feat:support auth.](https://github.com/Tencent/spring-cloud-tencent/pull/1479) - [feat:upgrade trace plugin.](https://github.com/Tencent/spring-cloud-tencent/pull/1480) - [feat:support smooth upgrade from tsf.](https://github.com/Tencent/spring-cloud-tencent/pull/1482) +- [fix:fix caller disposable metadata handle when using tracing.](https://github.com/Tencent/spring-cloud-tencent/pull/1483) diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java index d3a27fcea..f09a12685 100644 --- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java +++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java @@ -166,9 +166,11 @@ public final class MetadataContextHolder { } // caller disposable metadata to caller custom disposable metadata MetadataContainer metadataContainerDownstream = metadataManager.getMetadataContainer(MetadataType.CUSTOM, false); + MetadataContainer callerCustomMetadataContainer = metadataManager.getMetadataContainer(MetadataType.CUSTOM, true); if (!CollectionUtils.isEmpty(dynamicDisposableMetadata)) { for (Map.Entry entry : dynamicDisposableMetadata.entrySet()) { metadataContainerDownstream.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.NONE); + callerCustomMetadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.DISPOSABLE); } } // caller application metadata to caller application disposable metadata