From 76e05747c6ea3291c56586d1ddc7788c9f35aad9 Mon Sep 17 00:00:00 2001 From: HzjNeverStop <441627022@qq.com> Date: Thu, 3 Aug 2023 16:11:02 +0800 Subject: [PATCH] Support springcloud 3.1.x (#512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * support springcloud 2022 * support springcloud 2022 * support springcloud 2022 * update sofa common tools --------- Co-authored-by: 致节 --- pom.xml | 23 +- .../sofa-tracer-datasource-plugin/pom.xml | 2 +- .../sofa-tracer-dubbo-2.6.x-plugin/pom.xml | 7 +- .../sofa-tracer-dubbo-common-plugin/pom.xml | 2 +- .../sofa-tracer-dubbo-plugin/pom.xml | 2 +- .../sofa-tracer-flexible-plugin/pom.xml | 2 +- .../sofa-tracer-httpclient-plugin/pom.xml | 2 +- .../sofa-tracer-kafkamq-plugin/pom.xml | 2 +- .../consumer/SofaTracerKafkaConsumer.java | 36 +- .../producer/SofaTracerKafkaProducer.java | 14 +- .../sofa-tracer-mongodb-plugin/pom.xml | 3 +- .../sofa-tracer-okhttp-plugin/pom.xml | 2 +- .../sofa-tracer-rabbitmq-plugin/pom.xml | 7 +- .../base/MockRabbitMqExtractCarrier.java | 5 +- .../sofa-tracer-redis-plugin/pom.xml | 4 +- .../spring/redis/common/RedisCommand.java | 19 + ...TracingReactiveRedisClusterConnection.java | 104 +++++- .../TracingReactiveRedisConnection.java | 6 + .../TracingRedisClusterConnection.java | 31 ++ .../connections/TracingRedisConnection.java | 350 ++++++++++++++++++ .../TracingRedisSentinelConnection.java | 6 +- .../sofa-tracer-resttmplate-plugin/pom.xml | 2 +- .../sofa-tracer-rocketmq-plugin/pom.xml | 2 +- .../sofa-tracer-spring-cloud-plugin/pom.xml | 2 +- .../feign/SofaTracerFeignContext.java | 14 +- .../SofaTracerLoadBalancedFeignClient.java | 35 -- .../sofa-tracer-springmessage-plugin/pom.xml | 2 +- .../sofa-tracer-springmvc-plugin/pom.xml | 2 +- .../sofa-tracer-zipkin-plugin/pom.xml | 2 +- tracer-all/pom.xml | 4 +- tracer-core/pom.xml | 2 +- tracer-extensions/pom.xml | 2 +- tracer-sofa-boot-starter/pom.xml | 14 +- tracer-test/core-test/pom.xml | 2 +- tracer-test/log4j-test/pom.xml | 2 +- tracer-test/log4j2-test/pom.xml | 2 +- tracer-test/logback-test/pom.xml | 2 +- 37 files changed, 602 insertions(+), 118 deletions(-) delete mode 100644 sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerLoadBalancedFeignClient.java diff --git a/pom.xml b/pom.xml index 20fcffc88..8773db634 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ com.alipay.sofa sofaboot-dependencies - 3.1.1 + 3.19.1 tracer-all-parent - 3.1.3-SNAPSHOT + 3.1.3 pom tracer-all-parent Alipay SOFATracer Log Implemented by OpenTracing @@ -35,7 +35,6 @@ sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin sofa-tracer-plugins/sofa-tracer-kafkamq-plugin tracer-all - tracer-sofa-boot-starter tracer-test/core-test tracer-test/logback-test tracer-test/log4j2-test @@ -51,6 +50,7 @@ ${user.dir} 1.6.7 1.5 + 2021.0.7 @@ -209,16 +209,10 @@ org.springframework.cloud - spring-cloud-starter-openfeign - 2.1.0.RELEASE - provided - - - - org.springframework.cloud - spring-cloud-stream - 2.1.0.RELEASE - provided + spring-cloud-dependencies + ${spring-cloud.version} + pom + import @@ -230,7 +224,7 @@ com.alipay.sofa.common sofa-common-tools - 1.3.1 + 1.3.11 @@ -366,7 +360,6 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 ${java.compiler.source.version} ${java.compiler.target.version} diff --git a/sofa-tracer-plugins/sofa-tracer-datasource-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-datasource-plugin/pom.xml index ecd494632..f7572baa2 100644 --- a/sofa-tracer-plugins/sofa-tracer-datasource-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-datasource-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-dubbo-2.6.x-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-dubbo-2.6.x-plugin/pom.xml index 169f80fc7..bbf7134f8 100644 --- a/sofa-tracer-plugins/sofa-tracer-dubbo-2.6.x-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-dubbo-2.6.x-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 @@ -36,6 +36,11 @@ com.alibaba fastjson + + org.javassist + javassist + test + diff --git a/sofa-tracer-plugins/sofa-tracer-dubbo-common-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-dubbo-common-plugin/pom.xml index e79fd1980..8081f4f60 100644 --- a/sofa-tracer-plugins/sofa-tracer-dubbo-common-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-dubbo-common-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-dubbo-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-dubbo-plugin/pom.xml index 65e78e8d4..4f42c058f 100644 --- a/sofa-tracer-plugins/sofa-tracer-dubbo-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-dubbo-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-flexible-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-flexible-plugin/pom.xml index 8df616784..71e071765 100644 --- a/sofa-tracer-plugins/sofa-tracer-flexible-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-flexible-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-httpclient-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-httpclient-plugin/pom.xml index 1e33c4b80..321c4aa1b 100644 --- a/sofa-tracer-plugins/sofa-tracer-httpclient-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/pom.xml index 77783acce..e0cd8dfac 100644 --- a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/consumer/SofaTracerKafkaConsumer.java b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/consumer/SofaTracerKafkaConsumer.java index caa6521c7..a796a86c5 100644 --- a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/consumer/SofaTracerKafkaConsumer.java +++ b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/consumer/SofaTracerKafkaConsumer.java @@ -25,6 +25,7 @@ import com.sofa.alipay.tracer.plugins.kafkamq.carrier.KafkaMqExtractCarrier; import com.sofa.alipay.tracer.plugins.kafkamq.tracers.KafkaMQConsumeTracer; import org.apache.kafka.clients.consumer.Consumer; +import org.apache.kafka.clients.consumer.ConsumerGroupMetadata; import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; @@ -41,6 +42,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.OptionalLong; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; @@ -176,6 +178,11 @@ public void seek(TopicPartition partition, long offset) { consumer.seek(partition, offset); } + @Override + public void seek(TopicPartition topicPartition, OffsetAndMetadata offsetAndMetadata) { + consumer.seek(topicPartition, offsetAndMetadata); + } + @Override public void seekToBeginning(Collection partitions) { consumer.seekToBeginning(partitions); @@ -206,6 +213,17 @@ public OffsetAndMetadata committed(TopicPartition partition, Duration timeout) { return consumer.committed(partition, timeout); } + @Override + public Map committed(Set set) { + return null; + } + + @Override + public Map committed(Set set, + Duration duration) { + return null; + } + @Override public Map metrics() { return consumer.metrics(); @@ -280,13 +298,23 @@ public Map endOffsets(Collection partition } @Override - public void close() { - consumer.close(); + public OptionalLong currentLag(TopicPartition topicPartition) { + return consumer.currentLag(topicPartition); } @Override - public void close(long timeout, TimeUnit unit) { - consumer.close(timeout, unit); + public ConsumerGroupMetadata groupMetadata() { + return consumer.groupMetadata(); + } + + @Override + public void enforceRebalance() { + consumer.enforceRebalance(); + } + + @Override + public void close() { + consumer.close(); } @Override diff --git a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/producer/SofaTracerKafkaProducer.java b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/producer/SofaTracerKafkaProducer.java index 40b36eb18..7951e781f 100644 --- a/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/producer/SofaTracerKafkaProducer.java +++ b/sofa-tracer-plugins/sofa-tracer-kafkamq-plugin/src/main/java/com/sofa/alipay/tracer/plugins/kafkamq/producer/SofaTracerKafkaProducer.java @@ -27,6 +27,7 @@ import com.alipay.common.tracer.core.tracer.AbstractTracer; import com.sofa.alipay.tracer.plugins.kafkamq.carrier.KafkaMqInjectCarrier; import com.sofa.alipay.tracer.plugins.kafkamq.tracers.KafkaMQSendTracer; +import org.apache.kafka.clients.consumer.ConsumerGroupMetadata; import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.clients.producer.Callback; import org.apache.kafka.clients.producer.Producer; @@ -39,11 +40,11 @@ import org.apache.kafka.common.errors.ProducerFencedException; import org.apache.kafka.common.header.Headers; +import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; /** * SofaTracerKafkaProducer. @@ -87,6 +88,13 @@ public void sendOffsetsToTransaction(Map offs producer.sendOffsetsToTransaction(offsets, consumerGroupId); } + @Override + public void sendOffsetsToTransaction(Map map, + ConsumerGroupMetadata consumerGroupMetadata) + throws ProducerFencedException { + producer.sendOffsetsToTransaction(map, consumerGroupMetadata); + } + @Override public void commitTransaction() throws ProducerFencedException { producer.commitTransaction(); @@ -138,8 +146,8 @@ public void close() { } @Override - public void close(long timeout, TimeUnit timeUnit) { - producer.close(timeout, timeUnit); + public void close(Duration duration) { + producer.close(duration); } private void appendSpanTagsAndInject(ProducerRecord producerRecord, diff --git a/sofa-tracer-plugins/sofa-tracer-mongodb-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-mongodb-plugin/pom.xml index ea6a0745c..33c14d7ce 100644 --- a/sofa-tracer-plugins/sofa-tracer-mongodb-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-mongodb-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 @@ -27,6 +27,7 @@ org.mongodb mongodb-driver + 3.8.2 provided diff --git a/sofa-tracer-plugins/sofa-tracer-okhttp-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-okhttp-plugin/pom.xml index 8ca510156..74b12ae76 100644 --- a/sofa-tracer-plugins/sofa-tracer-okhttp-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-okhttp-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/pom.xml index be4d926e2..070bf11fa 100644 --- a/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 @@ -48,6 +48,11 @@ 2.10.0 test + + org.apache.commons + commons-collections4 + test + org.springframework.boot spring-boot-starter-test diff --git a/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/src/test/java/com/sofa/tracer/plugins/rabbitmq/base/MockRabbitMqExtractCarrier.java b/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/src/test/java/com/sofa/tracer/plugins/rabbitmq/base/MockRabbitMqExtractCarrier.java index 3624c3c2e..f56fba0a0 100644 --- a/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/src/test/java/com/sofa/tracer/plugins/rabbitmq/base/MockRabbitMqExtractCarrier.java +++ b/sofa-tracer-plugins/sofa-tracer-rabbitmq-plugin/src/test/java/com/sofa/tracer/plugins/rabbitmq/base/MockRabbitMqExtractCarrier.java @@ -17,6 +17,7 @@ package com.sofa.tracer.plugins.rabbitmq.base; import com.sofa.alipay.tracer.plugins.rabbitmq.carrier.RabbitMqExtractCarrier; +import org.apache.commons.collections4.IteratorUtils; import org.junit.Test; import java.util.Collections; @@ -40,7 +41,7 @@ public void testIterator() { Map headers = Collections.singletonMap(key, value); RabbitMqExtractCarrier carrier = new RabbitMqExtractCarrier(headers); final Iterator> iterator = carrier.iterator(); - assertThat(iterator).containsAll(map.entrySet()); + assertThat(IteratorUtils.toList(iterator)).containsAll(map.entrySet()); } @Test @@ -48,7 +49,7 @@ public void testIterator_whenNullValue() { Map headers = Collections.singletonMap("testSOFATracerId", null); RabbitMqExtractCarrier carrier = new RabbitMqExtractCarrier(headers); final Iterator> iterator = carrier.iterator(); - assertThat(iterator).doesNotContainNull(); + assertThat(IteratorUtils.toList(iterator)).doesNotContainNull(); } @Test(expected = UnsupportedOperationException.class) diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-redis-plugin/pom.xml index 7108d48c6..a4a4b2e87 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 @@ -28,7 +28,6 @@ io.projectreactor reactor-core - 3.1.9.RELEASE provided @@ -47,7 +46,6 @@ org.springframework spring-test - ${spring.version} test diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/common/RedisCommand.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/common/RedisCommand.java index ea42c0a57..4e81869f6 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/common/RedisCommand.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/common/RedisCommand.java @@ -72,6 +72,7 @@ public final class RedisCommand { public static final String CONFIG_REWRITE = "CONFIG REWRITE"; public static final String CONFIG_SET = "CONFIG SET"; public static final String CONFIG_RESETSTAT = "CONFIG RESETSTAT"; + public static final String COPY = "COPY"; public static final String DBSIZE = "DBSIZE"; public static final String DEBUG_OBJECT = "DEBUG OBJECT"; public static final String DEBUG_SEGFAULT = "DEBUG SEGFAULT"; @@ -96,7 +97,10 @@ public final class RedisCommand { public static final String GEORADIUS = "GEORADIUS"; public static final String GEORADIUSBYMEMBER = "GEORADIUSBYMEMBER"; public static final String GEOREMOVE = "GEOREMOVE"; + public static final String GEOSEARCH = "GEOSEARCH"; public static final String GET = "GET"; + public static final String GETDEL = "GETDEL"; + public static final String GETEX = "GETEX"; public static final String GETBIT = "GETBIT"; public static final String GETRANGE = "GETRANGE"; public static final String GETSET = "GETSET"; @@ -104,6 +108,7 @@ public final class RedisCommand { public static final String HEXISTS = "HEXISTS"; public static final String HGET = "HGET"; public static final String HGETALL = "HGETALL"; + public static final String HRANDFIELD = "HRANDFIELD"; public static final String HINCRBY = "HINCRBY"; public static final String HINCRBYFLOAT = "HINCRBYFLOAT"; public static final String HKEYS = "HKEYS"; @@ -122,6 +127,7 @@ public final class RedisCommand { public static final String LASTSAVE = "LASTSAVE"; public static final String LINDEX = "LINDEX"; public static final String LINSERT = "LINSERT"; + public static final String LMOV = "LMOV"; public static final String LLEN = "LLEN"; public static final String LPOP = "LPOP"; public static final String LPUSH = "LPUSH"; @@ -168,6 +174,7 @@ public final class RedisCommand { public static final String RPOP = "RPOP"; public static final String RPOPLPUSH = "RPOPLPUSH"; public static final String RPUSH = "RPUSH"; + public static final String LPOS = "LPOS"; public static final String RPUSHX = "RPUSHX"; public static final String SADD = "SADD"; public static final String SAVE = "SAVE"; @@ -215,6 +222,8 @@ public final class RedisCommand { public static final String WAIT = "WAIT"; public static final String WATCH = "WATCH"; public static final String ZADD = "ZADD"; + public static final String ZDIFF = "ZDIFF"; + public static final String ZINTER = "ZINTER"; public static final String ZCARD = "ZCARD"; public static final String ZCOUNT = "ZCOUNT"; public static final String ZINCRBY = "ZINCRBY"; @@ -230,6 +239,7 @@ public final class RedisCommand { public static final String ZRANGEBYSCORE_WITHSCORES = "ZRANGEBYSCORE WITHSCORES"; public static final String ZRANK = "ZRANK"; public static final String ZREM = "ZREM"; + public static final String ZRANDMEMBER = "ZRANDMEMBER"; public static final String ZREMRANGE = "ZREMRANGE"; public static final String ZREMRANGEBYLEX = "ZREMRANGEBYLEX"; public static final String ZREMRANGEBYRANK = "ZREMRANGEBYRANK"; @@ -240,18 +250,27 @@ public final class RedisCommand { public static final String ZREVRANGEBYSCORE_WITHSCORES = "ZREVRANGEBYSCORE WITHSCORES"; public static final String ZREVRANK = "ZREVRANK"; public static final String ZSCORE = "ZSCORE"; + public static final String ZUNION = "ZUNION"; public static final String ZUNIONSTORE = "ZUNIONSTORE"; public static final String SCAN = "SCAN"; public static final String SSCAN = "SSCAN"; public static final String HSCAN = "HSCAN"; public static final String ZSCAN = "ZSCAN"; + public static final String XACK = "XACK"; public static final String XADD = "XADD"; + public static final String XCLAIM = "XCLAIM"; + public static final String XDEL = "XDEL"; + public static final String XGROUPCREATE = "XGROUPCREATE"; + public static final String XGROUPDELCONSUMER = "XGROUPDELCONSUMER"; + public static final String XGROUPDESTORY = "XGROUPDESTORY"; + public static final String XINFO = "XINFO"; public static final String XRANGE = "XRANGE"; public static final String XREVRANGE = "XREVRANGE"; public static final String XLEN = "XLEN"; public static final String XREAD = "XREAD"; public static final String XREADGROUP = "XREADGROUP"; public static final String XPENDING = "XPENDING"; + public static final String XTRIM = "XTRIM"; public static final String ENCODING = "ENCODING"; public static final String IDLETIME = "IDLETIME"; public static final String REFCOUNT = "REFCOUNT"; diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisClusterConnection.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisClusterConnection.java index d0c4438b2..c7153d4e9 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisClusterConnection.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisClusterConnection.java @@ -18,6 +18,7 @@ import com.sofa.alipay.tracer.plugins.spring.redis.common.RedisActionWrapperHelper; import com.sofa.alipay.tracer.plugins.spring.redis.common.RedisCommand; +import org.springframework.data.redis.connection.ClusterInfo; import org.springframework.data.redis.connection.ReactiveClusterGeoCommands; import org.springframework.data.redis.connection.ReactiveClusterHashCommands; import org.springframework.data.redis.connection.ReactiveClusterHyperLogLogCommands; @@ -26,14 +27,20 @@ import org.springframework.data.redis.connection.ReactiveClusterNumberCommands; import org.springframework.data.redis.connection.ReactiveClusterServerCommands; import org.springframework.data.redis.connection.ReactiveClusterSetCommands; +import org.springframework.data.redis.connection.ReactiveClusterStreamCommands; import org.springframework.data.redis.connection.ReactiveClusterStringCommands; import org.springframework.data.redis.connection.ReactiveClusterZSetCommands; import org.springframework.data.redis.connection.ReactivePubSubCommands; import org.springframework.data.redis.connection.ReactiveRedisClusterConnection; import org.springframework.data.redis.connection.ReactiveScriptingCommands; import org.springframework.data.redis.connection.RedisClusterNode; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import java.util.Collection; +import java.util.Map; + public class TracingReactiveRedisClusterConnection implements ReactiveRedisClusterConnection { private final ReactiveRedisClusterConnection reactiveRedisClusterConnection; @@ -100,6 +107,11 @@ public ReactiveClusterServerCommands serverCommands() { return reactiveRedisClusterConnection.serverCommands(); } + @Override + public ReactiveClusterStreamCommands streamCommands() { + return reactiveRedisClusterConnection.streamCommands(); + } + @Override public Mono ping(RedisClusterNode node) { return actionWrapper.doInScope(RedisCommand.PING, @@ -122,7 +134,93 @@ public ReactiveScriptingCommands scriptingCommands() { } @Override - public Mono ping() { - return actionWrapper.doInScope(RedisCommand.PING, () -> reactiveRedisClusterConnection.ping()); - } + public Mono ping() { + return actionWrapper.doInScope(RedisCommand.PING, () -> reactiveRedisClusterConnection.ping()); + } + + @Override + public Flux clusterGetNodes() { + return reactiveRedisClusterConnection.clusterGetNodes(); + } + + @Override + public Flux clusterGetSlaves(RedisClusterNode master) { + return reactiveRedisClusterConnection.clusterGetSlaves(master); + } + + @Override + public Mono>> clusterGetMasterSlaveMap() { + return reactiveRedisClusterConnection.clusterGetMasterSlaveMap(); + } + + @Override + public Mono clusterGetSlotForKey(ByteBuffer key) { + return reactiveRedisClusterConnection.clusterGetSlotForKey(key); + } + + @Override + public Mono clusterGetNodeForSlot(int slot) { + return reactiveRedisClusterConnection.clusterGetNodeForSlot(slot); + } + + @Override + public Mono clusterGetNodeForKey(ByteBuffer key) { + return reactiveRedisClusterConnection.clusterGetNodeForKey(key); + } + + @Override + public Mono clusterGetClusterInfo() { + return reactiveRedisClusterConnection.clusterGetClusterInfo(); + } + + @Override + public Mono clusterAddSlots(RedisClusterNode node, int... slots) { + return reactiveRedisClusterConnection.clusterAddSlots(node, slots); + } + + @Override + public Mono clusterAddSlots(RedisClusterNode node, RedisClusterNode.SlotRange range) { + return reactiveRedisClusterConnection.clusterAddSlots(node, range); + } + + @Override + public Mono clusterCountKeysInSlot(int slot) { + return reactiveRedisClusterConnection.clusterCountKeysInSlot(slot); + } + + @Override + public Mono clusterDeleteSlots(RedisClusterNode node, int... slots) { + return reactiveRedisClusterConnection.clusterDeleteSlots(node, slots); + } + + @Override + public Mono clusterDeleteSlotsInRange(RedisClusterNode node, + RedisClusterNode.SlotRange range) { + return reactiveRedisClusterConnection.clusterDeleteSlotsInRange(node, range); + } + + @Override + public Mono clusterForget(RedisClusterNode node) { + return reactiveRedisClusterConnection.clusterForget(node); + } + + @Override + public Mono clusterMeet(RedisClusterNode node) { + return reactiveRedisClusterConnection.clusterMeet(node); + } + + @Override + public Mono clusterSetSlot(RedisClusterNode node, int slot, AddSlots mode) { + return reactiveRedisClusterConnection.clusterSetSlot(node, slot, mode); + } + + @Override + public Flux clusterGetKeysInSlot(int slot, int count) { + return reactiveRedisClusterConnection.clusterGetKeysInSlot(slot, count); + } + + @Override + public Mono clusterReplicate(RedisClusterNode master, RedisClusterNode replica) { + return reactiveRedisClusterConnection.clusterReplicate(master, replica); + } } diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisConnection.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisConnection.java index 10d14c719..275e54aea 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisConnection.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingReactiveRedisConnection.java @@ -29,6 +29,7 @@ import org.springframework.data.redis.connection.ReactiveScriptingCommands; import org.springframework.data.redis.connection.ReactiveServerCommands; import org.springframework.data.redis.connection.ReactiveSetCommands; +import org.springframework.data.redis.connection.ReactiveStreamCommands; import org.springframework.data.redis.connection.ReactiveStringCommands; import org.springframework.data.redis.connection.ReactiveZSetCommands; import reactor.core.publisher.Mono; @@ -113,6 +114,11 @@ public ReactiveServerCommands serverCommands() { return reactiveRedisConnection.serverCommands(); } + @Override + public ReactiveStreamCommands streamCommands() { + return reactiveRedisConnection.streamCommands(); + } + @Override public Mono ping() { return actionWrapper.doInScope(RedisCommand.PING, reactiveRedisConnection::ping); diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisClusterConnection.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisClusterConnection.java index d99e8fe88..b660afc2e 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisClusterConnection.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisClusterConnection.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.concurrent.TimeUnit; import static com.sofa.alipay.tracer.plugins.spring.redis.common.RedisCommand.*; @@ -178,11 +179,21 @@ public void flushDb(RedisClusterNode node) { actionWrapper.doInScope(FLUSHDB, () -> connection.flushDb(node)); } + @Override + public void flushDb(RedisClusterNode node, FlushOption option) { + actionWrapper.doInScope(FLUSHDB, () -> connection.flushDb(node, option)); + } + @Override public void flushAll(RedisClusterNode node) { actionWrapper.doInScope(FLUSHALL, () -> connection.flushAll(node)); } + @Override + public void flushAll(RedisClusterNode node, FlushOption option) { + actionWrapper.doInScope(FLUSHALL, () -> connection.flushAll(node, option)); + } + @Override public Properties info(RedisClusterNode node) { return actionWrapper.doInScope(INFO, () -> connection.info(node)); @@ -233,13 +244,33 @@ public void resetConfigStats(RedisClusterNode node) { actionWrapper.doInScope(CONFIG_RESETSTAT, () -> connection.resetConfigStats(node)); } + @Override + public void rewriteConfig(RedisClusterNode node) { + actionWrapper.doInScope(CONFIG_REWRITE, () -> connection.rewriteConfig(node)); + } + @Override public Long time(RedisClusterNode node) { return actionWrapper.doInScope(TIME, () -> connection.time(node)); } + @Override + public Long time(RedisClusterNode node, TimeUnit timeUnit) { + return actionWrapper.doInScope(TIME, () -> connection.time(node, timeUnit)); + } + @Override public List getClientList(RedisClusterNode node) { return actionWrapper.doInScope(CLIENT_LIST, () -> connection.getClientList(node)); } + + @Override + public void slaveOf(String host, int port) { + actionWrapper.doInScope(SLAVEOF, () -> connection.slaveOf(host, port)); + } + + @Override + public void slaveOfNoOne() { + actionWrapper.doInScope(SLAVEOFNOONE, connection::slaveOfNoOne); + } } diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisConnection.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisConnection.java index 31d97a525..7ca0d2fd8 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisConnection.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisConnection.java @@ -19,6 +19,7 @@ import com.sofa.alipay.tracer.plugins.spring.redis.common.RedisActionWrapperHelper; import com.sofa.alipay.tracer.plugins.spring.redis.common.RedisCommand; import org.springframework.dao.DataAccessException; +import org.springframework.data.domain.Range; import org.springframework.data.geo.Circle; import org.springframework.data.geo.Distance; import org.springframework.data.geo.GeoResults; @@ -45,10 +46,22 @@ import org.springframework.data.redis.connection.SortParameters; import org.springframework.data.redis.connection.Subscription; import org.springframework.data.redis.connection.ValueEncoding; +import org.springframework.data.redis.connection.stream.ByteRecord; +import org.springframework.data.redis.connection.stream.Consumer; +import org.springframework.data.redis.connection.stream.MapRecord; +import org.springframework.data.redis.connection.stream.PendingMessages; +import org.springframework.data.redis.connection.stream.PendingMessagesSummary; +import org.springframework.data.redis.connection.stream.ReadOffset; +import org.springframework.data.redis.connection.stream.RecordId; +import org.springframework.data.redis.connection.stream.StreamInfo; +import org.springframework.data.redis.connection.stream.StreamOffset; +import org.springframework.data.redis.connection.stream.StreamReadOptions; import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.ScanOptions; import org.springframework.data.redis.core.types.Expiration; import org.springframework.data.redis.core.types.RedisClientInfo; +import org.springframework.data.redis.domain.geo.GeoReference; +import org.springframework.data.redis.domain.geo.GeoShape; import java.time.Duration; import java.util.List; @@ -177,6 +190,11 @@ public Object execute(String command, byte[]... args) { return actionWrapper.doInScope(command, () -> connection.execute(command, args)); } + @Override + public Boolean copy(byte[] sourceKey, byte[] targetKey, boolean replace) { + return actionWrapper.doInScope(RedisCommand.COPY, () -> connection.copy(sourceKey, targetKey, replace)); + } + @Override public Boolean exists(byte[] key) { return actionWrapper.doInScope(RedisCommand.EXISTS, key, () -> connection.exists(key)); @@ -331,6 +349,16 @@ public byte[] get(byte[] key) { return actionWrapper.doInScope(RedisCommand.GET, key, () -> connection.get(key)); } + @Override + public byte[] getDel(byte[] key) { + return actionWrapper.doInScope(RedisCommand.GETDEL, key, () -> connection.getDel(key)); + } + + @Override + public byte[] getEx(byte[] key, Expiration expiration) { + return actionWrapper.doInScope(RedisCommand.GETEX, key, () -> connection.getEx(key, expiration)); + } + @Override public byte[] getSet(byte[] key, byte[] value) { return actionWrapper.doInScope(RedisCommand.GETSET, key, () -> connection.getSet(key, value)); @@ -465,6 +493,11 @@ public Long rPush(byte[] key, byte[]... values) { return actionWrapper.doInScope(RedisCommand.RPUSH, key, () -> connection.rPush(key, values)); } + @Override + public List lPos(byte[] key, byte[] element, Integer rank, Integer count) { + return actionWrapper.doInScope(RedisCommand.LPOS, key, () -> connection.lPos(key, element, rank, count)); + } + @Override public Long lPush(byte[] key, byte[]... values) { return actionWrapper.doInScope(RedisCommand.LPUSH, key, () -> connection.lPush(key, values)); @@ -506,6 +539,19 @@ public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) { .doInScope(RedisCommand.LINSERT, key, () -> connection.lInsert(key, where, pivot, value)); } + @Override + public byte[] lMove(byte[] sourceKey, byte[] destinationKey, Direction from, Direction to) { + return actionWrapper + .doInScope(RedisCommand.LMOV, () -> connection.lMove(sourceKey, destinationKey, from, to)); + } + + @Override + public byte[] bLMove(byte[] sourceKey, byte[] destinationKey, Direction from, Direction to, + double timeout) { + return actionWrapper + .doInScope(RedisCommand.LMOV, () -> connection.bLMove(sourceKey, destinationKey, from, to, timeout)); + } + @Override public void lSet(byte[] key, long index, byte[] value) { actionWrapper.doInScope(RedisCommand.LSET, key, () -> connection.lSet(key, index, value)); @@ -521,11 +567,21 @@ public byte[] lPop(byte[] key) { return actionWrapper.doInScope(RedisCommand.LPOP, key, () -> connection.lPop(key)); } + @Override + public List lPop(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.LPOP, key, () -> connection.lPop(key, count)); + } + @Override public byte[] rPop(byte[] key) { return actionWrapper.doInScope(RedisCommand.RPOP, key, () -> connection.rPop(key)); } + @Override + public List rPop(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.RPOP, key, () -> connection.rPop(key, count)); + } + @Override public List bLPop(int timeout, byte[]... keys) { return actionWrapper.doInScope(RedisCommand.BLPOP, keys, () -> connection.bLPop(timeout, keys)); @@ -584,6 +640,11 @@ public Boolean sIsMember(byte[] key, byte[] value) { return actionWrapper.doInScope(RedisCommand.SISMEMBER, key, () -> connection.sIsMember(key, value)); } + @Override + public List sMIsMember(byte[] key, byte[]... values) { + return actionWrapper.doInScope(RedisCommand.SISMEMBER, key, () -> connection.sMIsMember(key, values)); + } + @Override public Set sInter(byte[]... keys) { return actionWrapper.doInScope(RedisCommand.SINTER, keys, () -> connection.sInter(keys)); @@ -643,11 +704,21 @@ public Boolean zAdd(byte[] key, double score, byte[] value) { return actionWrapper.doInScope(RedisCommand.ZADD, key, () -> connection.zAdd(key, score, value)); } + @Override + public Boolean zAdd(byte[] key, double score, byte[] value, ZAddArgs args) { + return actionWrapper.doInScope(RedisCommand.ZADD, key, () -> connection.zAdd(key, score, value, args)); + } + @Override public Long zAdd(byte[] key, Set tuples) { return actionWrapper.doInScope(RedisCommand.ZADD, key, () -> connection.zAdd(key, tuples)); } + @Override + public Long zAdd(byte[] key, Set tuples, ZAddArgs args) { + return actionWrapper.doInScope(RedisCommand.ZADD, key, () -> connection.zAdd(key, tuples, args)); + } + @Override public Long zRem(byte[] key, byte[]... values) { return actionWrapper.doInScope(RedisCommand.ZREM, key, () -> connection.zRem(key, values)); @@ -659,6 +730,26 @@ public Double zIncrBy(byte[] key, double increment, byte[] value) { .doInScope(RedisCommand.ZINCRBY, key, () -> connection.zIncrBy(key, increment, value)); } + @Override + public byte[] zRandMember(byte[] key) { + return actionWrapper.doInScope(RedisCommand.ZRANDMEMBER, key, () -> connection.zRandMember(key)); + } + + @Override + public List zRandMember(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.ZRANDMEMBER, key, () -> connection.zRandMember(key, count)); + } + + @Override + public Tuple zRandMemberWithScore(byte[] key) { + return actionWrapper.doInScope(RedisCommand.ZRANDMEMBER, key, () -> connection.zRandMemberWithScore(key)); + } + + @Override + public List zRandMemberWithScore(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.ZRANDMEMBER, key, () -> connection.zRandMemberWithScore(key, count)); + } + @Override public Long zRank(byte[] key, byte[] value) { return actionWrapper.doInScope(RedisCommand.ZRANK, key, () -> connection.zRank(key, value)); @@ -812,6 +903,41 @@ public Long zCount(byte[] key, Range range) { return actionWrapper.doInScope(RedisCommand.ZCOUNT, key, () -> connection.zCount(key, range)); } + @Override + public Long zLexCount(byte[] key, Range range) { + return actionWrapper.doInScope(RedisCommand.ZLEXCOUNT, key, () -> connection.zLexCount(key, range)); + } + + @Override + public Tuple zPopMin(byte[] key) { + return actionWrapper.doInScope(RedisCommand.ZPOPMIN, key, () -> connection.zPopMin(key)); + } + + @Override + public Set zPopMin(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.ZPOPMIN, key, () -> connection.zPopMin(key, count)); + } + + @Override + public Tuple bZPopMin(byte[] key, long timeout, TimeUnit unit) { + return actionWrapper.doInScope(RedisCommand.BZPOPMIN, key, () -> connection.bZPopMin(key, timeout, unit)); + } + + @Override + public Tuple zPopMax(byte[] key) { + return actionWrapper.doInScope(RedisCommand.ZPOPMAX, key, () -> connection.zPopMax(key)); + } + + @Override + public Set zPopMax(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.ZPOPMAX, key, () -> connection.zPopMax(key, count)); + } + + @Override + public Tuple bZPopMax(byte[] key, long timeout, TimeUnit unit) { + return actionWrapper.doInScope(RedisCommand.BZPOPMAX, key, () -> connection.bZPopMax(key, timeout, unit)); + } + @Override public Long zCard(byte[] key) { return actionWrapper.doInScope(RedisCommand.ZCARD, key, () -> connection.zCard(key)); @@ -822,12 +948,23 @@ public Double zScore(byte[] key, byte[] value) { return actionWrapper.doInScope(RedisCommand.ZSCORE, key, () -> connection.zScore(key, value)); } + @Override + public List zMScore(byte[] key, byte[]... values) { + return actionWrapper.doInScope(RedisCommand.ZSCORE, key, () -> connection.zMScore(key, values)); + } + @Override public Long zRemRange(byte[] key, long start, long end) { return actionWrapper .doInScope(RedisCommand.ZREMRANGE, key, () -> connection.zRemRange(key, start, end)); } + @Override + public Long zRemRangeByLex(byte[] key, Range range) { + return actionWrapper + .doInScope(RedisCommand.ZREMRANGE, key, () -> connection.zRemRangeByLex(key, range)); + } + @Override public Long zRemRangeByScore(byte[] key, double min, double max) { return actionWrapper.doInScope(RedisCommand.ZREMRANGEBYSCORE, @@ -840,6 +977,36 @@ public Long zRemRangeByScore(byte[] key, Range range) { () -> connection.zRemRangeByScore(key, range)); } + @Override + public Set zDiff(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZDIFF, () -> connection.zDiff(sets)); + } + + @Override + public Set zDiffWithScores(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZDIFF, () -> connection.zDiffWithScores(sets)); + } + + @Override + public Long zDiffStore(byte[] destKey, byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZDIFF, () -> connection.zDiffStore(destKey, sets)); + } + + @Override + public Set zInter(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZINTER, () -> connection.zInter(sets)); + } + + @Override + public Set zInterWithScores(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZINTER, () -> connection.zInterWithScores(sets)); + } + + @Override + public Set zInterWithScores(Aggregate aggregate, Weights weights, byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZINTER, () -> connection.zInterWithScores(aggregate, weights, sets)); + } + @Override public Long zUnionStore(byte[] destKey, byte[]... sets) { return actionWrapper.doInScope(RedisCommand.ZUNIONSTORE, () -> connection.zUnionStore(destKey, sets)); @@ -875,6 +1042,21 @@ public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, by destKey, () -> connection.zInterStore(destKey, aggregate, weights, sets)); } + @Override + public Set zUnion(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZUNION, () -> connection.zUnion(sets)); + } + + @Override + public Set zUnionWithScores(byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZUNION, () -> connection.zUnionWithScores(sets)); + } + + @Override + public Set zUnionWithScores(Aggregate aggregate, Weights weights, byte[]... sets) { + return actionWrapper.doInScope(RedisCommand.ZUNION, () -> connection.zUnionWithScores(aggregate, weights, sets)); + } + @Override public Cursor zScan(byte[] key, ScanOptions options) { return actionWrapper.doInScope(RedisCommand.ZSCAN, key, () -> connection.zScan(key, options)); @@ -897,6 +1079,12 @@ public Set zRangeByLex(byte[] key, Range range, Limit limit) { .doInScope(RedisCommand.ZRANGEBYLEX, key, () -> connection.zRangeByLex(key, range, limit)); } + @Override + public Set zRevRangeByLex(byte[] key, Range range, Limit limit) { + return actionWrapper + .doInScope(RedisCommand.ZRANGEBYLEX, key, () -> connection.zRevRangeByLex(key, range, limit)); + } + @Override public Boolean hSet(byte[] key, byte[] field, byte[] value) { return actionWrapper.doInScope(RedisCommand.HSET, key, () -> connection.hSet(key, field, value)); @@ -962,6 +1150,26 @@ public Map hGetAll(byte[] key) { return actionWrapper.doInScope(RedisCommand.HGETALL, key, () -> connection.hGetAll(key)); } + @Override + public byte[] hRandField(byte[] key) { + return actionWrapper.doInScope(RedisCommand.HRANDFIELD, key, () -> connection.hRandField(key)); + } + + @Override + public Entry hRandFieldWithValues(byte[] key) { + return actionWrapper.doInScope(RedisCommand.HRANDFIELD, key, () -> connection.hRandFieldWithValues(key)); + } + + @Override + public List hRandField(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.HRANDFIELD, key, () -> connection.hRandField(key, count)); + } + + @Override + public List> hRandFieldWithValues(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.HRANDFIELD, key, () -> connection.hRandFieldWithValues(key, count)); + } + @Override public Cursor> hScan(byte[] key, ScanOptions options) { return actionWrapper.doInScope(RedisCommand.HSCAN, key, () -> connection.hScan(key, options)); @@ -1062,11 +1270,21 @@ public void flushDb() { actionWrapper.doInScope(RedisCommand.FLUSHDB, () -> connection.flushDb()); } + @Override + public void flushDb(FlushOption option) { + actionWrapper.doInScope(RedisCommand.FLUSHDB, () -> connection.flushDb(option)); + } + @Override public void flushAll() { actionWrapper.doInScope(RedisCommand.FLUSHALL, () -> connection.flushAll()); } + @Override + public void flushAll(FlushOption option) { + actionWrapper.doInScope(RedisCommand.FLUSHALL, () -> connection.flushAll(option)); + } + @Override public Properties info() { return actionWrapper.doInScope(RedisCommand.INFO, () -> connection.info()); @@ -1102,11 +1320,21 @@ public void resetConfigStats() { actionWrapper.doInScope(RedisCommand.CONFIG_RESETSTAT, () -> connection.resetConfigStats()); } + @Override + public void rewriteConfig() { + actionWrapper.doInScope(RedisCommand.CONFIG_REWRITE, () -> connection.rewriteConfig()); + } + @Override public Long time() { return actionWrapper.doInScope(RedisCommand.TIME, () -> connection.time()); } + @Override + public Long time(TimeUnit timeUnit) { + return actionWrapper.doInScope(RedisCommand.TIME, () -> connection.time(timeUnit)); + } + @Override public void killClient(String host, int port) { actionWrapper.doInScope(RedisCommand.CLIENT_KILL, () -> connection.killClient(host, port)); @@ -1271,6 +1499,18 @@ public Long geoRemove(byte[] key, byte[]... members) { return actionWrapper.doInScope(RedisCommand.GEOREMOVE, key, () -> connection.geoRemove(key, members)); } + @Override + public GeoResults> geoSearch(byte[] key, GeoReference reference, + GeoShape predicate, GeoSearchCommandArgs args) { + return actionWrapper.doInScope(RedisCommand.GEOSEARCH, key, () -> connection.geoSearch(key, reference, predicate, args)); + } + + @Override + public Long geoSearchStore(byte[] destKey, byte[] key, GeoReference reference, + GeoShape predicate, GeoSearchStoreCommandArgs args) { + return actionWrapper.doInScope(RedisCommand.GEOSEARCH, key, () -> connection.geoSearchStore(destKey, key, reference, predicate, args)); + } + @Override public Long pfAdd(byte[] key, byte[]... values) { return actionWrapper.doInScope(RedisCommand.PFADD, key, () -> connection.pfAdd(key, values)); @@ -1286,4 +1526,114 @@ public void pfMerge(byte[] destinationKey, byte[]... sourceKeys) { actionWrapper.doInScope(RedisCommand.PFMERGE, () -> connection.pfMerge(destinationKey, sourceKeys)); } + + @Override + public Long xAck(byte[] key, String group, RecordId... recordIds) { + return actionWrapper.doInScope(RedisCommand.XACK, key, () -> connection.xAck(key, group, recordIds)); + } + + @Override + public RecordId xAdd(MapRecord record, XAddOptions options) { + return actionWrapper.doInScope(RedisCommand.XADD, () -> connection.xAdd(record, options)); + } + + @Override + public List xClaimJustId(byte[] key, String group, String newOwner, + XClaimOptions options) { + return actionWrapper.doInScope(RedisCommand.XCLAIM, key, () -> connection.xClaimJustId(key, group, newOwner, options)); + } + + @Override + public List xClaim(byte[] key, String group, String newOwner, XClaimOptions options) { + return actionWrapper.doInScope(RedisCommand.XCLAIM, key, () -> connection.xClaim(key, group, newOwner, options)); + } + + @Override + public Long xDel(byte[] key, RecordId... recordIds) { + return actionWrapper.doInScope(RedisCommand.XDEL, key, () -> connection.xDel(key, recordIds)); + } + + @Override + public String xGroupCreate(byte[] key, String groupName, ReadOffset readOffset) { + return actionWrapper.doInScope(RedisCommand.XGROUPCREATE, key, () -> connection.xGroupCreate(key, groupName, readOffset)); + } + + @Override + public String xGroupCreate(byte[] key, String groupName, ReadOffset readOffset, boolean mkStream) { + return actionWrapper.doInScope(RedisCommand.XGROUPCREATE, key, () -> connection.xGroupCreate(key, groupName, readOffset, mkStream)); + } + + @Override + public Boolean xGroupDelConsumer(byte[] key, Consumer consumer) { + return actionWrapper.doInScope(RedisCommand.XGROUPDELCONSUMER, key, () -> connection.xGroupDelConsumer(key, consumer)); + } + + @Override + public Boolean xGroupDestroy(byte[] key, String groupName) { + return actionWrapper.doInScope(RedisCommand.XGROUPDESTORY, key, () -> connection.xGroupDestroy(key, groupName)); + } + + @Override + public StreamInfo.XInfoStream xInfo(byte[] key) { + return actionWrapper.doInScope(RedisCommand.XINFO, key, () -> connection.xInfo(key)); + } + + @Override + public StreamInfo.XInfoGroups xInfoGroups(byte[] key) { + return actionWrapper.doInScope(RedisCommand.XINFO, key, () -> connection.xInfoGroups(key)); + } + + @Override + public StreamInfo.XInfoConsumers xInfoConsumers(byte[] key, String groupName) { + return actionWrapper.doInScope(RedisCommand.XINFO, key, () -> connection.xInfoConsumers(key, groupName)); + } + + @Override + public Long xLen(byte[] key) { + return actionWrapper.doInScope(RedisCommand.XLEN, key, () -> connection.xLen(key)); + } + + @Override + public PendingMessagesSummary xPending(byte[] key, String groupName) { + return actionWrapper.doInScope(RedisCommand.XPENDING, key, () -> connection.xPending(key, groupName)); + } + + @Override + public PendingMessages xPending(byte[] key, String groupName, XPendingOptions options) { + return actionWrapper.doInScope(RedisCommand.XPENDING, key, () -> connection.xPending(key, groupName, options)); + } + + @Override + public List xRange(byte[] key, org.springframework.data.domain.Range range, + Limit limit) { + return actionWrapper.doInScope(RedisCommand.XRANGE, key, () -> connection.xRange(key, range, limit)); + } + + @Override + public List xRead(StreamReadOptions readOptions, StreamOffset... streams) { + return actionWrapper.doInScope(RedisCommand.XREAD, () -> connection.xRead(readOptions, streams)); + } + + @Override + public List xReadGroup(Consumer consumer, StreamReadOptions readOptions, + StreamOffset... streams) { + return actionWrapper.doInScope(RedisCommand.XREADGROUP, () -> connection.xReadGroup(consumer, readOptions, streams)); + } + + @Override + public List xRevRange(byte[] key, + org.springframework.data.domain.Range range, + Limit limit) { + return actionWrapper.doInScope(RedisCommand.XREVRANGE, key, () -> connection.xRevRange(key, range, limit)); + } + + @Override + public Long xTrim(byte[] key, long count) { + return actionWrapper.doInScope(RedisCommand.XTRIM, key, () -> connection.xTrim(key, count)); + } + + @Override + public Long xTrim(byte[] key, long count, boolean approximateTrimming) { + return actionWrapper.doInScope(RedisCommand.XTRIM, key, () -> connection.xTrim(key, count, approximateTrimming)); + } } diff --git a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisSentinelConnection.java b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisSentinelConnection.java index d9e647f32..be7895fb7 100644 --- a/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisSentinelConnection.java +++ b/sofa-tracer-plugins/sofa-tracer-redis-plugin/src/main/java/com/sofa/alipay/tracer/plugins/spring/redis/connections/TracingRedisSentinelConnection.java @@ -50,9 +50,9 @@ public Collection masters() { } @Override - public Collection slaves(NamedNode master) { - return actionWrapper.decorate(() -> redisSentinelConnection.slaves(master),"slaves"); - } + public Collection slaves(NamedNode master) { + return actionWrapper.decorate(() -> redisSentinelConnection.slaves(master), "slaves"); + } @Override public void remove(NamedNode master) { diff --git a/sofa-tracer-plugins/sofa-tracer-resttmplate-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-resttmplate-plugin/pom.xml index b5da4b560..f48538e06 100644 --- a/sofa-tracer-plugins/sofa-tracer-resttmplate-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-resttmplate-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-rocketmq-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-rocketmq-plugin/pom.xml index d854172a3..035f972ad 100644 --- a/sofa-tracer-plugins/sofa-tracer-rocketmq-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-rocketmq-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/pom.xml index 25b1870f7..6a8ee7082 100644 --- a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerFeignContext.java b/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerFeignContext.java index ae7c70e02..cfdaa1ff5 100644 --- a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerFeignContext.java +++ b/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerFeignContext.java @@ -18,10 +18,7 @@ import feign.Client; import org.springframework.beans.factory.BeanFactory; -import org.springframework.cloud.netflix.ribbon.SpringClientFactory; import org.springframework.cloud.openfeign.FeignContext; -import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory; -import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient; import java.util.HashMap; import java.util.Map; @@ -59,19 +56,10 @@ public Map getInstances(String name, Class type) { private Object wrapperFeignClient(Object bean) { // not need to wrapper - if (bean instanceof SofaTracerFeignClient - || bean instanceof SofaTracerLoadBalancedFeignClient) { + if (bean instanceof SofaTracerFeignClient) { return bean; } if (bean instanceof Client) { - // LoadBalancerFeignClient Type Wrapper to SofaTracerLoadBalancedFeignClient - if (bean instanceof LoadBalancerFeignClient - && !(bean instanceof SofaTracerLoadBalancedFeignClient)) { - return new SofaTracerLoadBalancedFeignClient( - newSofaTracerFeignClient(((LoadBalancerFeignClient) bean).getDelegate()), - beanFactory.getBean(CachingSpringLoadBalancerFactory.class), - beanFactory.getBean(SpringClientFactory.class)); - } return newSofaTracerFeignClient((Client) bean); } return bean; diff --git a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerLoadBalancedFeignClient.java b/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerLoadBalancedFeignClient.java deleted file mode 100644 index f5cdf05d4..000000000 --- a/sofa-tracer-plugins/sofa-tracer-spring-cloud-plugin/src/main/java/com/alipay/sofa/tracer/plugins/springcloud/instruments/feign/SofaTracerLoadBalancedFeignClient.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 com.alipay.sofa.tracer.plugins.springcloud.instruments.feign; - -import feign.Client; -import org.springframework.cloud.netflix.ribbon.SpringClientFactory; -import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory; -import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient; - -/** - * @author: guolei.sgl (guolei.sgl@antfin.com) 2019/3/13 5:53 PM - * @since: - **/ -public class SofaTracerLoadBalancedFeignClient extends LoadBalancerFeignClient { - - public SofaTracerLoadBalancedFeignClient(Client client, - CachingSpringLoadBalancerFactory cachingSpringLoadBalancerFactory, - SpringClientFactory clientFactory) { - super(client, cachingSpringLoadBalancerFactory, clientFactory); - } -} \ No newline at end of file diff --git a/sofa-tracer-plugins/sofa-tracer-springmessage-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-springmessage-plugin/pom.xml index ffb5a45f7..a4717adb7 100644 --- a/sofa-tracer-plugins/sofa-tracer-springmessage-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-springmessage-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/sofa-tracer-plugins/sofa-tracer-springmvc-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-springmvc-plugin/pom.xml index 0c73f24ae..1d03303c1 100644 --- a/sofa-tracer-plugins/sofa-tracer-springmvc-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-springmvc-plugin/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml diff --git a/sofa-tracer-plugins/sofa-tracer-zipkin-plugin/pom.xml b/sofa-tracer-plugins/sofa-tracer-zipkin-plugin/pom.xml index 8cfce4d80..90d32a435 100644 --- a/sofa-tracer-plugins/sofa-tracer-zipkin-plugin/pom.xml +++ b/sofa-tracer-plugins/sofa-tracer-zipkin-plugin/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml 4.0.0 diff --git a/tracer-all/pom.xml b/tracer-all/pom.xml index 6435be460..35117679b 100644 --- a/tracer-all/pom.xml +++ b/tracer-all/pom.xml @@ -5,12 +5,12 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 4.0.0 tracer-all - 3.1.3-SNAPSHOT + 3.1.3 jar SOFATracer in one without SOFABoot starter diff --git a/tracer-core/pom.xml b/tracer-core/pom.xml index d5ba68e87..f77d00638 100644 --- a/tracer-core/pom.xml +++ b/tracer-core/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../pom.xml diff --git a/tracer-extensions/pom.xml b/tracer-extensions/pom.xml index 21fa995f8..f18ac57fa 100644 --- a/tracer-extensions/pom.xml +++ b/tracer-extensions/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 tracer-extensions diff --git a/tracer-sofa-boot-starter/pom.xml b/tracer-sofa-boot-starter/pom.xml index 66d38b57d..d0ee6eb68 100644 --- a/tracer-sofa-boot-starter/pom.xml +++ b/tracer-sofa-boot-starter/pom.xml @@ -5,7 +5,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../pom.xml @@ -99,10 +99,6 @@ org.springframework.boot spring-boot-autoconfigure - - com.alipay.sofa - infra-sofa-boot-starter - org.springframework.boot @@ -146,17 +142,9 @@ true - - org.mongodb - mongodb-driver - 3.8.2 - true - - org.springframework.data spring-data-mongodb - 2.1.8.RELEASE true diff --git a/tracer-test/core-test/pom.xml b/tracer-test/core-test/pom.xml index cd89b14af..ae62bd314 100644 --- a/tracer-test/core-test/pom.xml +++ b/tracer-test/core-test/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml diff --git a/tracer-test/log4j-test/pom.xml b/tracer-test/log4j-test/pom.xml index 54431d322..b5ee59052 100644 --- a/tracer-test/log4j-test/pom.xml +++ b/tracer-test/log4j-test/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml diff --git a/tracer-test/log4j2-test/pom.xml b/tracer-test/log4j2-test/pom.xml index 4c20041bb..d6fca9f99 100644 --- a/tracer-test/log4j2-test/pom.xml +++ b/tracer-test/log4j2-test/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml diff --git a/tracer-test/logback-test/pom.xml b/tracer-test/logback-test/pom.xml index cd01a59e6..364a211bf 100644 --- a/tracer-test/logback-test/pom.xml +++ b/tracer-test/logback-test/pom.xml @@ -4,7 +4,7 @@ tracer-all-parent com.alipay.sofa - 3.1.3-SNAPSHOT + 3.1.3 ../../pom.xml