diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index 9efab982bf5b2e42befee10ef5cdbed51374fd91..48418d2d29e61e66769479843a3554ed18192e27 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -158,6 +158,12 @@ public class Config {
}
public static class Plugin {
+
+ /**
+ * Control the length of the peer field.
+ */
+ public static int PEER_MAX_LENGTH = 200;
+
public static class MongoDB {
/**
* If true, trace all the parameters in MongoDB access, default is false. Only trace the operation, not include parameters.
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
index c4fbcdf4512ec77e1a93a6865a803db4d699d7ea..b7ed19db39fc864f86e1ecc73364738d3ee5c6c9 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
@@ -18,17 +18,6 @@
package org.apache.skywalking.apm.agent.core.conf;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
import org.apache.skywalking.apm.agent.core.boot.AgentPackageNotFoundException;
import org.apache.skywalking.apm.agent.core.boot.AgentPackagePath;
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
@@ -37,6 +26,9 @@ import org.apache.skywalking.apm.util.ConfigInitializer;
import org.apache.skywalking.apm.util.PropertyPlaceholderHelper;
import org.apache.skywalking.apm.util.StringUtil;
+import java.io.*;
+import java.util.*;
+
/**
* The SnifferConfigInitializer
initializes all configs in several way.
*
@@ -100,6 +92,10 @@ public class SnifferConfigInitializer {
if (StringUtil.isEmpty(Config.Collector.BACKEND_SERVICE)) {
throw new ExceptionInInitializerError("`collector.backend_service` is missing.");
}
+ if (Config.Plugin.PEER_MAX_LENGTH <= 3) {
+ logger.warn("PEER_MAX_LENGTH configuration:{} error, the default value of 200 will be used.", Config.Plugin.PEER_MAX_LENGTH);
+ Config.Plugin.PEER_MAX_LENGTH = 200;
+ }
IS_INIT_COMPLETED = true;
}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/util/PeerFormat.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/util/PeerFormat.java
new file mode 100644
index 0000000000000000000000000000000000000000..1c27c369133820e31a2012ee985ed3f0a9463053
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/util/PeerFormat.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.agent.core.context.util;
+
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.util.StringUtil;
+
+/**
+ * @author zhaoyuguang
+ */
+
+public class PeerFormat {
+
+ private static final String ABBR = "...";
+
+ public static String shorten(String original) {
+ if (!StringUtil.isEmpty(original) && original.length() > Config.Plugin.PEER_MAX_LENGTH) {
+ return original.substring(0, Config.Plugin.PEER_MAX_LENGTH - 3) + ABBR;
+ }
+ return original;
+ }
+}
diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/PeerFormatTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/PeerFormatTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..dea8fd3622a189b905b00bf271c58a3c389143fd
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/PeerFormatTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.agent.core.util;
+
+import org.apache.skywalking.apm.agent.core.context.util.PeerFormat;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author zhaoyuguang
+ */
+
+public class PeerFormatTest {
+
+ @Test
+ public void testShorten() {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 100; i++) {
+ sb.append("localhost:" + i + ";");
+ }
+ Assert.assertTrue(PeerFormat.shorten(sb.toString()).length() == 200);
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptor.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptor.java
index d7d420b5413739a39ff2edd827ed15db53219efe..f4f4367770429c6282599e6861c1e992aa324afa 100644
--- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptor.java
@@ -19,11 +19,13 @@
package org.apache.skywalking.apm.plugin.jedis.v2;
-import java.util.Set;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
+import org.apache.skywalking.apm.agent.core.context.util.PeerFormat;
import redis.clients.jedis.HostAndPort;
+import java.util.Set;
+
public class JedisClusterConstructorWithListHostAndPortArgInterceptor implements InstanceConstructorInterceptor {
@Override
@@ -34,6 +36,6 @@ public class JedisClusterConstructorWithListHostAndPortArgInterceptor implements
redisConnInfo.append(hostAndPort.toString()).append(";");
}
- objInst.setSkyWalkingDynamicField(redisConnInfo.toString());
+ objInst.setSkyWalkingDynamicField(PeerFormat.shorten(redisConnInfo.toString()));
}
}
diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptorTest.java
index b2fbc81ae601f0a916c92922a3076807af879f72..b0abfe5a050f6aa2d82ec42f19b9e9b68db66eb4 100644
--- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisClusterConstructorWithListHostAndPortArgInterceptorTest.java
@@ -18,10 +18,9 @@
package org.apache.skywalking.apm.plugin.jedis.v2;
-import java.util.LinkedHashSet;
-import java.util.Set;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -29,6 +28,9 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import redis.clients.jedis.HostAndPort;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
import static org.mockito.Mockito.verify;
@RunWith(MockitoJUnitRunner.class)
@@ -56,9 +58,32 @@ public class JedisClusterConstructorWithListHostAndPortArgInterceptorTest {
@Test
public void onConstruct() throws Exception {
- interceptor.onConstruct(enhancedInstance, new Object[] {hostAndPortSet});
+ interceptor.onConstruct(enhancedInstance, new Object[]{hostAndPortSet});
verify(enhancedInstance).setSkyWalkingDynamicField("127.0.0.1:6379;127.0.0.1:16379;");
}
+ @Test
+ public void onHugeClusterConstruct() throws Exception {
+ hostAndPortSet = new LinkedHashSet();
+ for (int i = 0; i < 100; i++) {
+ hostAndPortSet.add(new HostAndPort("localhost", i));
+ }
+ enhancedInstance = new EnhancedInstance() {
+ private Object v;
+
+ @Override
+ public Object getSkyWalkingDynamicField() {
+ return v;
+ }
+
+ @Override
+ public void setSkyWalkingDynamicField(Object value) {
+ this.v = value;
+ }
+ };
+ interceptor.onConstruct(enhancedInstance, new Object[]{hostAndPortSet});
+ Assert.assertTrue(enhancedInstance.getSkyWalkingDynamicField().toString().length() == 200);
+ }
+
}
diff --git a/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/ConsumerConstructorInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/ConsumerConstructorInterceptorTest.java
index e6125ba78c5fedbcb634d9d0180efa035d7dd169..ad642dd843f5acd7c1b4d6c636cdb69501cce30e 100644
--- a/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/ConsumerConstructorInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/ConsumerConstructorInterceptorTest.java
@@ -18,8 +18,6 @@
package org.apache.skywalking.apm.plugin.kafka.v11;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.plugin.kafka.v1.ConsumerConstructorInterceptor;
@@ -29,6 +27,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
+import java.util.ArrayList;
+import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
diff --git a/apm-sniffer/apm-sdk-plugin/redisson-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/redisson/v3/ConnectionManagerInterceptor.java b/apm-sniffer/apm-sdk-plugin/redisson-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/redisson/v3/ConnectionManagerInterceptor.java
index 6ff4cec5379ae3077d719223504ee96570376bfe..07c99179f3fbb6268f6b8255cebdfa720b37e10d 100644
--- a/apm-sniffer/apm-sdk-plugin/redisson-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/redisson/v3/ConnectionManagerInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/redisson-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/redisson/v3/ConnectionManagerInterceptor.java
@@ -23,6 +23,7 @@ import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.agent.core.context.util.PeerFormat;
import org.redisson.config.*;
import org.redisson.connection.ConnectionManager;
@@ -60,24 +61,24 @@ public class ConnectionManagerInterceptor implements InstanceMethodsAroundInterc
if (sentinelServersConfig != null) {
appendAddresses(peer, sentinelServersConfig.getSentinelAddresses());
- retInst.setSkyWalkingDynamicField(peer.toString());
+ retInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
return ret;
}
if (masterSlaveServersConfig != null) {
URI masterAddress = masterSlaveServersConfig.getMasterAddress();
peer.append(masterAddress.getHost()).append(":").append(masterAddress.getPort());
appendAddresses(peer, masterSlaveServersConfig.getSlaveAddresses());
- retInst.setSkyWalkingDynamicField(peer.toString());
+ retInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
return ret;
}
if (clusterServersConfig != null) {
appendAddresses(peer, clusterServersConfig.getNodeAddresses());
- retInst.setSkyWalkingDynamicField(peer.toString());
+ retInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
return ret;
}
if (replicatedServersConfig != null) {
appendAddresses(peer, replicatedServersConfig.getNodeAddresses());
- retInst.setSkyWalkingDynamicField(peer.toString());
+ retInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
return ret;
}
} catch (Exception e) {
diff --git a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisClusterClientConstructorInterceptor.java b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisClusterClientConstructorInterceptor.java
index a8f71655d58ba0bbdb964dfd8a938cca9f5cb82e..035b06b49d40987dc2eeaa8c6b7789d836dd23de 100644
--- a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisClusterClientConstructorInterceptor.java
+++ b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisClusterClientConstructorInterceptor.java
@@ -23,6 +23,7 @@ import io.lettuce.core.RedisURI;
import io.lettuce.core.cluster.RedisClusterClient;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
+import org.apache.skywalking.apm.agent.core.context.util.PeerFormat;
/**
* @author zhaoyuguang
@@ -39,6 +40,6 @@ public class RedisClusterClientConstructorInterceptor implements InstanceConstru
peer.append(redisURI.getHost()).append(":").append(redisURI.getPort()).append(";");
}
EnhancedInstance optionsInst = (EnhancedInstance) redisClusterClient.getOptions();
- optionsInst.setSkyWalkingDynamicField(peer.toString());
+ optionsInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
}
}
diff --git a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptorTest.java b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptorTest.java
index 28f8b4722b2aad41f0e4083cef7e1767ce3fb748..4ee94ca62654782807d0d6cfe25770186eddbbb8 100644
--- a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptorTest.java
+++ b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptorTest.java
@@ -18,6 +18,7 @@
package org.apache.skywalking.apm.plugin.lettuce.v5;
+import io.lettuce.core.RedisURI;
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandType;
import io.lettuce.core.protocol.RedisCommand;
@@ -32,6 +33,8 @@ import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
+import org.apache.skywalking.apm.plugin.lettuce.v5.mock.MockRedisClusterClient;
+import org.apache.skywalking.apm.plugin.lettuce.v5.mock.MockRedisClusterClientConstructorInterceptor;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.hamcrest.core.Is;
@@ -43,6 +46,7 @@ import org.mockito.Mock;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
@@ -109,4 +113,17 @@ public class RedisChannelWriterInterceptorTest {
assertThat(tags.get(0).getValue(), is("Redis"));
assertThat(SpanHelper.getLayer(spans.get(0)), CoreMatchers.is(SpanLayer.CACHE));
}
+
+
+ @Test
+ public void testOnHugeClusterConsumerConfig() {
+ List redisURIs = new ArrayList<>(100);
+ for (int i = 0; i < 100; i++) {
+ redisURIs.add(RedisURI.create("localhost", i));
+ }
+ MockRedisClusterClient mockRedisClusterClient = new MockRedisClusterClient();
+ MockRedisClusterClientConstructorInterceptor constructorInterceptor = new MockRedisClusterClientConstructorInterceptor();
+ constructorInterceptor.onConstruct(mockRedisClusterClient, new Object[]{null, redisURIs});
+ assertThat(mockRedisClusterClient.getOptions().getSkyWalkingDynamicField().toString().length(), Is.is(200));
+ }
}
diff --git a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClient.java b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..21b1bcadd7c5b7d4b479a80bcf389d12134f42e3
--- /dev/null
+++ b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClient.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.lettuce.v5.mock;
+
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+
+/**
+ * @author zhaoyuguang
+ */
+
+public class MockRedisClusterClient implements EnhancedInstance {
+
+ private Object ms;
+
+ private EnhancedInstance options = new EnhancedInstance() {
+ private Object os;
+
+ @Override
+ public Object getSkyWalkingDynamicField() {
+ return os;
+ }
+
+ @Override
+ public void setSkyWalkingDynamicField(Object value) {
+ this.os = value;
+ }
+ };
+
+ public EnhancedInstance getOptions() {
+ return options;
+ }
+
+ public void setOptions(EnhancedInstance options) {
+ this.options = options;
+ }
+
+ @Override
+ public Object getSkyWalkingDynamicField() {
+ return ms;
+ }
+
+ @Override
+ public void setSkyWalkingDynamicField(Object value) {
+ this.ms = value;
+ }
+}
diff --git a/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClientConstructorInterceptor.java b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClientConstructorInterceptor.java
new file mode 100644
index 0000000000000000000000000000000000000000..a9502f073ff88c729995cb91971de6a5bae7566e
--- /dev/null
+++ b/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/lettuce/v5/mock/MockRedisClusterClientConstructorInterceptor.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.lettuce.v5.mock;
+
+import io.lettuce.core.RedisURI;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
+import org.apache.skywalking.apm.agent.core.context.util.PeerFormat;
+
+/**
+ * @author zhaoyuguang
+ */
+
+public class MockRedisClusterClientConstructorInterceptor implements InstanceConstructorInterceptor {
+
+ @Override
+ public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
+ @SuppressWarnings("unchecked")
+ Iterable redisURIs = (Iterable) allArguments[1];
+ MockRedisClusterClient redisClusterClient = (MockRedisClusterClient) objInst;
+ StringBuilder peer = new StringBuilder();
+ for (RedisURI redisURI : redisURIs) {
+ peer.append(redisURI.getHost()).append(":").append(redisURI.getPort()).append(";");
+ }
+ EnhancedInstance optionsInst = redisClusterClient.getOptions();
+ optionsInst.setSkyWalkingDynamicField(PeerFormat.shorten(peer.toString()));
+ }
+}
diff --git a/docs/en/setup/service-agent/java-agent/README.md b/docs/en/setup/service-agent/java-agent/README.md
index 247dd43845d1aa8f269cae58f44ed59914a8d39e..1e186c23f317ef4a17277bc10221fa96383e7b15 100644
--- a/docs/en/setup/service-agent/java-agent/README.md
+++ b/docs/en/setup/service-agent/java-agent/README.md
@@ -65,7 +65,7 @@ property key | Description | Default |
`agent.is_open_debugging_class`|If true, skywalking agent will save all instrumented classes files in `/debugging` folder.Skywalking team may ask for these files in order to resolve compatible problem.|Not set|
`agent.active_v2_header`|Active V2 header in default.|`true`|
`agent.instance_uuid` |Instance uuid is the identity of an instance, skywalking treat same instance uuid as one instance.if empty, skywalking agent will generate an 32-bit uuid. |`""`|
-`agent.cause_exception_depth`|How depth the agent goes, when log all cause exceptions.|5|
+`agent.cause_exception_depth`|How depth the agent goes, when log all cause exceptions.|`5`|
`agent.active_v1_header `|Deactive V1 header in default.|`false`|
`collector.grpc_channel_check_interval`|grpc channel status check interval.|`30`|
`collector.app_and_service_register_check_interval`|application and service registry check interval.|`3`|
@@ -79,6 +79,7 @@ property key | Description | Default |
`buffer.buffer_size`|The buffer size.|`300`|
`dictionary.service_code_buffer_size`|The buffer size of application codes and peer|`10 * 10000`|
`dictionary.endpoint_name_buffer_size`|The buffer size of endpoint names and peer|`1000 * 10000`|
+`plugin.peer_max_length `|Peer maximum description limit.|`200`|
`plugin.mongodb.trace_param`|If true, trace all the parameters in MongoDB access, default is false. Only trace the operation, not include parameters.|`false`|
`plugin.elasticsearch.trace_dsl`|If true, trace all the DSL(Domain Specific Language) in ElasticSearch access, default is false.|`false`|
`plugin.springmvc.use_qualified_name_as_endpoint_name`|If true, the fully qualified method name will be used as the endpoint name instead of the request URL, default is false.|`false`|