Repository: sermant-io/Sermant (java)

Issue:
Multiple dynamic mountings do not support different agent directories.
### What happened?

After the plug-in is mounted for the first time, run the uninstall-agent command to uninstall the plug-in. When the plug-in is mounted again, the agent directory of the plug-in cannot be modified and must be the same as the directory of the first time.

### How can we reproduce it (as minimally and precisely as possible)?

The plug-in is dynamically loaded for multiple times and uninstalled by running the unstall-agent command. The agent directory path of the plug-in is different each time.

### Anything else we need to know?

_No response_

### Sermant version

<details>
2.0.0
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```
</details>


Pull request:
fix: support dynamic install agent multi-times with different agent directory
**What type of PR is this?**

Bug

**What this PR does / why we need it?**

Currently when users dynamic install agent at the second time, the directory of new agent can not be a custom path. So this PR aims to fix this issue

**Which issue(s) this PR fixes？**

Fixes #1687

**Does this PR introduce a user-facing change?**

No

<!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->

## Checklist
- [x] Make sure there is a [GitHub_issue](https://github.com/sermant-io/Sermant/issues) related with this PR before you start working on it.
- [x] Make sure you have squashed your change to one single commit.
- [x] GitHub Actions works fine in this PR.


Patch:
diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/AgentCoreEntrance.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/AgentCoreEntrance.java
index c048519ff..e7d93de00 100644
--- a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/AgentCoreEntrance.java
+++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/AgentCoreEntrance.java
@@ -19,6 +19,7 @@ package io.sermant.core;
 import io.sermant.core.classloader.ClassLoaderManager;
 import io.sermant.core.common.AgentType;
 import io.sermant.core.common.BootArgsIndexer;
+import io.sermant.core.common.CommonConstant;
 import io.sermant.core.common.LoggerFactory;
 import io.sermant.core.config.ConfigManager;
 import io.sermant.core.event.EventManager;
@@ -35,6 +36,7 @@ import io.sermant.core.plugin.agent.adviser.AdviserScheduler;
 import io.sermant.core.plugin.agent.info.EnhancementManager;
 import io.sermant.core.plugin.agent.template.DefaultAdviser;
 import io.sermant.core.service.ServiceManager;
+import io.sermant.core.utils.FileUtils;
 import io.sermant.god.common.SermantManager;
 
 import java.lang.instrument.Instrumentation;
@@ -90,6 +92,8 @@ public class AgentCoreEntrance {
         LoggerFactory.initDefaultLogger(artifact);
         adviserCache = new DefaultAdviser();
 
+        FileUtils.setAgentPath((String) argsMap.get(CommonConstant.AGENT_PATH_KEY));
+
         // Initialize the classloader of framework
         ClassLoaderManager.init(argsMap);
 
diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/common/CommonConstant.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/common/CommonConstant.java
index e2aa2b06d..7533d49b2 100644
--- a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/common/CommonConstant.java
+++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/common/CommonConstant.java
@@ -127,6 +127,11 @@ public class CommonConstant {
      */
     public static final String ARTIFACT_NAME_KEY = "artifact";
 
+    /**
+     * The key of agent path
+     */
+    public static final String AGENT_PATH_KEY = "agentPath";
+
     private CommonConstant() {
     }
 }
diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/utils/FileUtils.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/utils/FileUtils.java
index 9174a020a..c5f6ba8bf 100644
--- a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/utils/FileUtils.java
+++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/utils/FileUtils.java
@@ -52,8 +52,7 @@ public class FileUtils {
 
     private static final String[] INVALID_SYMBOL = {"../", "..\\"};
 
-    private static final String AGENT_PATH = new File(new File(FileUtils.class.getProtectionDomain().getCodeSource()
-            .getLocation().getPath()).getParent()).getParent();
+    private static String agentPath;
 
     /**
      * file name of unmatched class name
@@ -79,7 +78,7 @@ public class FileUtils {
      * @return path
      */
     public static String getAgentPath() {
-        return AGENT_PATH;
+        return agentPath;
     }
 
     /**
@@ -89,7 +88,7 @@ public class FileUtils {
      * @return fixed path
      */
     public static String validatePath(String path) {
-        if (!path.startsWith(AGENT_PATH)) {
+        if (!path.startsWith(agentPath)) {
             return "";
         }
 
@@ -288,7 +287,7 @@ public class FileUtils {
         AgentConfig config = ConfigManager.getConfig(AgentConfig.class);
         String preFilterPath = config.getPreFilterPath();
         if (StringUtils.isEmpty(preFilterPath)) {
-            preFilterPath = AGENT_PATH;
+            preFilterPath = agentPath;
         }
         String preFilterFile = config.getPreFilterFile();
         if (StringUtils.isEmpty(preFilterFile)) {
@@ -296,4 +295,8 @@ public class FileUtils {
         }
         return preFilterPath + File.separatorChar + preFilterFile;
     }
+
+    public static void setAgentPath(String path) {
+        agentPath = path;
+    }
 }
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/src/main/java/io/sermant/tag/transmission/alibabadubbo/interceptors/AlibabaDubboConsumerInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/src/main/java/io/sermant/tag/transmission/alibabadubbo/interceptors/AlibabaDubboConsumerInterceptor.java
index 4a798e37f..baa586b65 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/src/main/java/io/sermant/tag/transmission/alibabadubbo/interceptors/AlibabaDubboConsumerInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/src/main/java/io/sermant/tag/transmission/alibabadubbo/interceptors/AlibabaDubboConsumerInterceptor.java
@@ -71,13 +71,6 @@ public class AlibabaDubboConsumerInterceptor extends AbstractClientInterceptor<R
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original attachment contains the specific key, then ignore
-            String originalAttachment = invocation.getAttachment(key);
-            if (originalAttachment != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // If the tag value is not null on the provider side, it will be converted to list storage. If it is null,
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/src/main/java/io/sermant/tag/transmission/apachedubbov2/interceptors/ApacheDubboConsumerInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/src/main/java/io/sermant/tag/transmission/apachedubbov2/interceptors/ApacheDubboConsumerInterceptor.java
index 8390804df..a1783882b 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/src/main/java/io/sermant/tag/transmission/apachedubbov2/interceptors/ApacheDubboConsumerInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/src/main/java/io/sermant/tag/transmission/apachedubbov2/interceptors/ApacheDubboConsumerInterceptor.java
@@ -66,13 +66,6 @@ public class ApacheDubboConsumerInterceptor extends AbstractClientInterceptor<Rp
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original attachment contains the specific key, then ignore
-            String originalAttachment = invocation.getAttachment(key);
-            if (originalAttachment != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // If the tag value is not null on the provider side, it will be converted to list storage. If it is null,
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/src/main/java/io/sermant/tag/transmission/dubbov3/interceptors/ApacheDubboConsumerInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/src/main/java/io/sermant/tag/transmission/dubbov3/interceptors/ApacheDubboConsumerInterceptor.java
index 649df8552..eb693401f 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/src/main/java/io/sermant/tag/transmission/dubbov3/interceptors/ApacheDubboConsumerInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/src/main/java/io/sermant/tag/transmission/dubbov3/interceptors/ApacheDubboConsumerInterceptor.java
@@ -66,13 +66,6 @@ public class ApacheDubboConsumerInterceptor extends AbstractClientInterceptor<Rp
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original attachment contains the specific key, then ignore
-            Object originalAttachment = invocation.getObjectAttachment(key);
-            if (originalAttachment != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // If the tag value is not null on the provider side, it will be converted to list storage. If it is null,
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-grpc-plugin/src/main/java/io/sermant/tag/transmission/grpc/interceptors/ClientCallImplInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-grpc-plugin/src/main/java/io/sermant/tag/transmission/grpc/interceptors/ClientCallImplInterceptor.java
index 451599b96..ac41dbc91 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-grpc-plugin/src/main/java/io/sermant/tag/transmission/grpc/interceptors/ClientCallImplInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-grpc-plugin/src/main/java/io/sermant/tag/transmission/grpc/interceptors/ClientCallImplInterceptor.java
@@ -65,13 +65,6 @@ public class ClientCallImplInterceptor extends AbstractClientInterceptor<Metadat
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original metadata contains the specific key, then ignore
-            String originalHeaderValue = header.get(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER));
-            if (originalHeaderValue != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient3.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv3/interceptors/HttpClient3xInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient3.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv3/interceptors/HttpClient3xInterceptor.java
index 5831e93a9..c822cadc8 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient3.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv3/interceptors/HttpClient3xInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient3.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv3/interceptors/HttpClient3xInterceptor.java
@@ -23,7 +23,6 @@ import io.sermant.core.utils.tag.TrafficUtils;
 import io.sermant.tag.transmission.config.strategy.TagKeyMatcher;
 import io.sermant.tag.transmission.interceptors.AbstractClientInterceptor;
 
-import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpMethod;
 
 import java.util.List;
@@ -67,13 +66,6 @@ public class HttpClient3xInterceptor extends AbstractClientInterceptor<HttpMetho
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Header originalRequestHeader = httpMethod.getRequestHeader(key);
-            if (originalRequestHeader != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient4.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv4/interceptors/HttpClient4xInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient4.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv4/interceptors/HttpClient4xInterceptor.java
index b3770037c..55037e98b 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient4.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv4/interceptors/HttpClient4xInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-httpclient4.x-plugin/src/main/java/io/sermant/tag/transmission/httpclientv4/interceptors/HttpClient4xInterceptor.java
@@ -23,7 +23,6 @@ import io.sermant.core.utils.tag.TrafficUtils;
 import io.sermant.tag.transmission.config.strategy.TagKeyMatcher;
 import io.sermant.tag.transmission.interceptors.AbstractClientInterceptor;
 
-import org.apache.http.Header;
 import org.apache.http.HttpRequest;
 
 import java.util.List;
@@ -67,13 +66,6 @@ public class HttpClient4xInterceptor extends AbstractClientInterceptor<HttpReque
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Header[] originalHeaders = httpRequest.getHeaders(key);
-            if (originalHeaders != null && originalHeaders.length != 0) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-jdkhttp-plugin/src/main/java/io/sermant/tag/transmission/jdkhttp/interceptors/JdkHttpClientInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-jdkhttp-plugin/src/main/java/io/sermant/tag/transmission/jdkhttp/interceptors/JdkHttpClientInterceptor.java
index e54d645af..13a44f325 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-jdkhttp-plugin/src/main/java/io/sermant/tag/transmission/jdkhttp/interceptors/JdkHttpClientInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-jdkhttp-plugin/src/main/java/io/sermant/tag/transmission/jdkhttp/interceptors/JdkHttpClientInterceptor.java
@@ -83,13 +83,6 @@ public class JdkHttpClientInterceptor extends AbstractClientInterceptor<MessageH
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Map<String, List<String>> originalHeaders = messageHeader.getHeaders();
-            if (!CollectionUtils.isEmpty(originalHeaders.get(key))) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-kafka-plugin/src/main/java/io/sermant/tag/transmission/kafka/interceptors/KafkaProducerInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-kafka-plugin/src/main/java/io/sermant/tag/transmission/kafka/interceptors/KafkaProducerInterceptor.java
index ac71e23f2..4c0721414 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-kafka-plugin/src/main/java/io/sermant/tag/transmission/kafka/interceptors/KafkaProducerInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-kafka-plugin/src/main/java/io/sermant/tag/transmission/kafka/interceptors/KafkaProducerInterceptor.java
@@ -24,7 +24,6 @@ import io.sermant.tag.transmission.config.strategy.TagKeyMatcher;
 import io.sermant.tag.transmission.interceptors.AbstractClientInterceptor;
 
 import org.apache.kafka.clients.producer.ProducerRecord;
-import org.apache.kafka.common.header.Header;
 import org.apache.kafka.common.header.Headers;
 
 import java.nio.charset.StandardCharsets;
@@ -70,13 +69,6 @@ public class KafkaProducerInterceptor extends AbstractClientInterceptor<Producer
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Header originalHeader = headers.lastHeader(key);
-            if (originalHeader != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // On the producer side, if the tag value is not null, it is converted to list storage. If it is null, it
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-okhttp2.x-plugin/src/main/java/io/sermant/tag/transmission/okhttpv2/interceptors/OkHttp2xInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-okhttp2.x-plugin/src/main/java/io/sermant/tag/transmission/okhttpv2/interceptors/OkHttp2xInterceptor.java
index de1116138..9c7c2b3ab 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-okhttp2.x-plugin/src/main/java/io/sermant/tag/transmission/okhttpv2/interceptors/OkHttp2xInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-okhttp2.x-plugin/src/main/java/io/sermant/tag/transmission/okhttpv2/interceptors/OkHttp2xInterceptor.java
@@ -16,20 +16,17 @@
 
 package io.sermant.tag.transmission.okhttpv2.interceptors;
 
-import com.squareup.okhttp.Headers;
 import com.squareup.okhttp.Request.Builder;
 
 import io.sermant.core.common.LoggerFactory;
 import io.sermant.core.plugin.agent.entity.ExecuteContext;
 import io.sermant.core.utils.CollectionUtils;
-import io.sermant.core.utils.ReflectUtils;
 import io.sermant.core.utils.tag.TrafficUtils;
 import io.sermant.tag.transmission.config.strategy.TagKeyMatcher;
 import io.sermant.tag.transmission.interceptors.AbstractClientInterceptor;
 
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -78,17 +75,6 @@ public class OkHttp2xInterceptor extends AbstractClientInterceptor<Builder> {
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Optional<Object> headersBuilderObject = ReflectUtils.getFieldValue(builder, "headers");
-            if (headersBuilderObject.isPresent()) {
-                Headers.Builder headersBuilder = (Headers.Builder) headersBuilderObject.get();
-                String value = headersBuilder.get(key);
-                if (value != null) {
-                    continue;
-                }
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq4.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv4/interceptors/RocketmqProducerSendInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq4.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv4/interceptors/RocketmqProducerSendInterceptor.java
index b52c583ba..3550a6477 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq4.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv4/interceptors/RocketmqProducerSendInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq4.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv4/interceptors/RocketmqProducerSendInterceptor.java
@@ -75,8 +75,8 @@ public class RocketmqProducerSendInterceptor extends AbstractClientInterceptor<S
     }
 
     /**
-     * Insert the traffic tag into the properties string. The format of the original properties is as follows:
-     * key1[SOH]value1[STX]key2[SOH]value2, [SOH] is the symbol of ASCII=1, [STX] is the symbol of ASCII=2
+     * Insert the traffic tag into the properties string. The format of the original properties is as
+     * follows: key1[SOH]value1[STX]key2[SOH]value2, [SOH] is the symbol of ASCII=1, [STX] is the symbol of ASCII=2
      *
      * @param oldProperties original properties
      * @return String
@@ -88,12 +88,6 @@ public class RocketmqProducerSendInterceptor extends AbstractClientInterceptor<S
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original properties contains the specific key, then ignore
-            if (oldProperties.contains(key)) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
             newProperties.append(key);
             newProperties.append(LINK_MARK);
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq5.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv5/interceptor/RocketmqProducerSendInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq5.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv5/interceptor/RocketmqProducerSendInterceptor.java
index 76e0542b6..43af1bf86 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq5.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv5/interceptor/RocketmqProducerSendInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-rocketmq5.x-plugin/src/main/java/io/sermant/tag/transmission/rocketmqv5/interceptor/RocketmqProducerSendInterceptor.java
@@ -75,8 +75,8 @@ public class RocketmqProducerSendInterceptor extends AbstractClientInterceptor<S
     }
 
     /**
-     * Insert the traffic tag into the properties string. The format of the original properties is as follows:
-     * key1[SOH]value1[STX]key2[SOH]value2, [SOH] is the symbol of ASCII=1, [STX] is the symbol of ASCII=2
+     * Insert the traffic tag into the properties string. The format of the original properties is as
+     * follows: key1[SOH]value1[STX]key2[SOH]value2, [SOH] is the symbol of ASCII=1, [STX] is the symbol of ASCII=2
      *
      * @param oldProperties original properties
      * @return String
@@ -88,12 +88,6 @@ public class RocketmqProducerSendInterceptor extends AbstractClientInterceptor<S
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original properties contains the specific key, then ignore
-            if (oldProperties.contains(key)) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
             newProperties.append(key);
             newProperties.append(LINK_MARK);
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/src/main/java/io/sermant/tag/transmission/servicecomb/interceptors/ServiceCombRpcConsumerInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/src/main/java/io/sermant/tag/transmission/servicecomb/interceptors/ServiceCombRpcConsumerInterceptor.java
index 140c31116..a050c9f01 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/src/main/java/io/sermant/tag/transmission/servicecomb/interceptors/ServiceCombRpcConsumerInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/src/main/java/io/sermant/tag/transmission/servicecomb/interceptors/ServiceCombRpcConsumerInterceptor.java
@@ -69,13 +69,6 @@ public class ServiceCombRpcConsumerInterceptor extends AbstractClientInterceptor
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            String originalHeader = invocation.getContext().get(key);
-            if (originalHeader != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // If the tag value is not null on the provider side, it will be converted to list storage. If it is null,
diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-sofarpc-plugin/src/main/java/io/sermant/tag/transmission/sofarpc/interceptors/SofaRpcClientInterceptor.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-sofarpc-plugin/src/main/java/io/sermant/tag/transmission/sofarpc/interceptors/SofaRpcClientInterceptor.java
index b3aa2b96c..84e2b6077 100644
--- a/sermant-plugins/sermant-tag-transmission/tag-transmission-sofarpc-plugin/src/main/java/io/sermant/tag/transmission/sofarpc/interceptors/SofaRpcClientInterceptor.java
+++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-sofarpc-plugin/src/main/java/io/sermant/tag/transmission/sofarpc/interceptors/SofaRpcClientInterceptor.java
@@ -69,13 +69,6 @@ public class SofaRpcClientInterceptor extends AbstractClientInterceptor<SofaRequ
             if (!TagKeyMatcher.isMatch(key)) {
                 continue;
             }
-
-            // if original headers contains the specific key, then ignore
-            Object originalHeader = sofaRequest.getRequestProp(key);
-            if (originalHeader != null) {
-                continue;
-            }
-
             List<String> values = entry.getValue();
 
             // The server side converts the label value to list storage when it is not null. If it is null, it directly


Test patch:
diff --git a/sermant-agentcore/sermant-agentcore-core/src/test/java/io/sermant/core/utils/FileUtilsTest.java b/sermant-agentcore/sermant-agentcore-core/src/test/java/io/sermant/core/utils/FileUtilsTest.java
index dfe45b03c..fa21dcbf0 100644
--- a/sermant-agentcore/sermant-agentcore-core/src/test/java/io/sermant/core/utils/FileUtilsTest.java
+++ b/sermant-agentcore/sermant-agentcore-core/src/test/java/io/sermant/core/utils/FileUtilsTest.java
@@ -29,7 +29,7 @@ public class FileUtilsTest {
     @Test
     public void testPath() {
         String pathValid = FileUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-        Assert.assertEquals(pathValid, FileUtils.validatePath(pathValid));
+        FileUtils.setAgentPath(pathValid);
         String pathInvalid = "/test/path";
         Assert.assertEquals("", FileUtils.validatePath(pathInvalid));
         String pathInvalidSymbolA = pathValid + "../" + "/test";
diff --git a/sermant-agentcore/sermant-agentcore-implement/src/test/java/io/sermant/implement/service/hotplugging/listener/HotPluggingListenerTest.java b/sermant-agentcore/sermant-agentcore-implement/src/test/java/io/sermant/implement/service/hotplugging/listener/HotPluggingListenerTest.java
index 00f16f100..b0a80deea 100644
--- a/sermant-agentcore/sermant-agentcore-implement/src/test/java/io/sermant/implement/service/hotplugging/listener/HotPluggingListenerTest.java
+++ b/sermant-agentcore/sermant-agentcore-implement/src/test/java/io/sermant/implement/service/hotplugging/listener/HotPluggingListenerTest.java
@@ -23,6 +23,7 @@ import io.sermant.core.operation.OperationManager;
 import io.sermant.core.operation.converter.api.YamlConverter;
 import io.sermant.core.service.dynamicconfig.common.DynamicConfigEvent;
 import io.sermant.core.service.dynamicconfig.common.DynamicConfigEventType;
+import io.sermant.core.utils.FileUtils;
 import io.sermant.core.utils.JarFileUtils;
 import io.sermant.core.utils.StringUtils;
 import io.sermant.implement.operation.converter.YamlConverterImpl;
@@ -84,6 +85,8 @@ public class HotPluggingListenerTest {
                 .thenReturn(YAML_CONVERTER);
         commandProcessorMockedStatic.verify(() -> CommandProcessor.process(any()), times(0));
         jarFileUtilsMockedStatic.when(() -> JarFileUtils.getManifestAttr(any(), anyString())).thenReturn("1.0.0");
+        String pathValid = FileUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath();
+        FileUtils.setAgentPath(pathValid);
         Map<String, Object> argsMap = new HashMap<>();
         argsMap.put(CommonConstant.CORE_IMPLEMENT_DIR_KEY, StringUtils.EMPTY);
         argsMap.put(CommonConstant.CORE_CONFIG_FILE_KEY, StringUtils.EMPTY);