From 73f3193a995c2158ad541cd2bc2beec0ef9a33e5 Mon Sep 17 00:00:00 2001 From: mxsl-gr Date: Tue, 5 Jul 2022 18:48:17 +0800 Subject: [PATCH] [fix][plugin-rocketmq] Fix agent tracing lost property separator (#93) --- .../agent/plugin/rocketmq/v4/MessageSendInterceptor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agent-plugins/agent-rocketmq-4.x-plugin/src/main/java/cloud/erda/agent/plugin/rocketmq/v4/MessageSendInterceptor.java b/agent-plugins/agent-rocketmq-4.x-plugin/src/main/java/cloud/erda/agent/plugin/rocketmq/v4/MessageSendInterceptor.java index 84976a1..b28a767 100644 --- a/agent-plugins/agent-rocketmq-4.x-plugin/src/main/java/cloud/erda/agent/plugin/rocketmq/v4/MessageSendInterceptor.java +++ b/agent-plugins/agent-rocketmq-4.x-plugin/src/main/java/cloud/erda/agent/plugin/rocketmq/v4/MessageSendInterceptor.java @@ -84,7 +84,12 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult tracer.inject(span.getContext(), carrier); SendMessageRequestHeader requestHeader = (SendMessageRequestHeader) context.getArguments()[3]; - StringBuilder properties = new StringBuilder(requestHeader.getProperties()); + StringBuilder properties = new StringBuilder(); + String originalProperties = requestHeader.getProperties(); + if(originalProperties != null && !originalProperties.isEmpty()) { + properties.append(originalProperties); + properties.append(MessageDecoder.PROPERTY_SEPARATOR); + } for (Map.Entry entry : map.entrySet()) { if (entry.getValue() == null) { continue;