fix some bugs and optimize example

pull/217/head
lepdou 3 years ago committed by Haotian Zhang
parent 71a047290c
commit 9158649ff8

@ -99,8 +99,9 @@ public class QuotaCheckReactiveFilter implements WebFilter, Ordered {
Map<String, String> labels = getRequestLabels(exchange, localNamespace, localService);
try {
String path = exchange.getRequest().getURI().getPath();
QuotaResponse quotaResponse = QuotaCheckUtils.getQuota(limitAPI,
localNamespace, localService, 1, labels, null);
localNamespace, localService, 1, labels, path);
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultLimited) {
ServerHttpResponse response = exchange.getResponse();

@ -95,7 +95,7 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter {
try {
QuotaResponse quotaResponse = QuotaCheckUtils.getQuota(limitAPI,
localNamespace, localService, 1, labels, null);
localNamespace, localService, 1, labels, request.getRequestURI());
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultLimited) {
response.setStatus(polarisRateLimitProperties.getRejectHttpCode());

@ -54,6 +54,7 @@ import com.tencent.polaris.router.api.rpc.ProcessRoutersRequest;
import com.tencent.polaris.router.api.rpc.ProcessRoutersResponse;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
*
@ -195,7 +196,9 @@ public class PolarisLoadBalancerCompositeRule extends AbstractLoadBalancerRule {
public AbstractLoadBalancerRule getRule() {
String loadBalanceStrategy = loadBalancerProperties.getStrategy();
if (StringUtils.isEmpty(loadBalanceStrategy)) {
return new ZoneAvoidanceRule();
}
switch (loadBalanceStrategy) {
case STRATEGY_RANDOM:
return new RandomRule();

@ -23,16 +23,6 @@
<artifactId>spring-cloud-starter-tencent-polaris-router</artifactId>
</dependency>
<dependency>
<artifactId>spring-cloud-starter-tencent-polaris-circuitbreaker</artifactId>
<groupId>com.tencent.cloud</groupId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-metadata-transfer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@ -76,4 +66,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

@ -9,8 +9,6 @@ spring:
address: grpc://183.47.111.80:8091
namespace: default
enabled: true
discovery:
service-list-refresh-interval: 1000
logging:
level:
org.springframework.cloud.gateway: info

@ -23,16 +23,6 @@
<artifactId>spring-cloud-starter-tencent-polaris-router</artifactId>
</dependency>
<dependency>
<artifactId>spring-cloud-starter-tencent-polaris-circuitbreaker</artifactId>
<groupId>com.tencent.cloud</groupId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-metadata-transfer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@ -76,4 +66,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

@ -9,8 +9,6 @@ spring:
address: grpc://183.47.111.80:8091
namespace: default
enabled: true
discovery:
service-list-refresh-interval: 1000
logging:
level:
org.springframework.cloud.gateway: info

@ -28,20 +28,11 @@
<artifactId>spring-cloud-starter-tencent-polaris-router</artifactId>
</dependency>
<dependency>
<artifactId>spring-cloud-starter-tencent-polaris-circuitbreaker</artifactId>
<groupId>com.tencent.cloud</groupId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-metadata-transfer</artifactId>
</dependency>
</dependencies>
<build>
@ -59,4 +50,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

@ -9,8 +9,6 @@ spring:
address: grpc://183.47.111.80:8091
namespace: default
enabled: true
discovery:
service-list-refresh-interval: 1000
logging:
level:
org.springframework.cloud.gateway: info

@ -23,16 +23,6 @@
<artifactId>spring-cloud-starter-tencent-polaris-router</artifactId>
</dependency>
<dependency>
<artifactId>spring-cloud-starter-tencent-polaris-circuitbreaker</artifactId>
<groupId>com.tencent.cloud</groupId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-metadata-transfer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@ -76,4 +66,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

@ -9,8 +9,6 @@ spring:
address: grpc://183.47.111.80:8091
namespace: default
enabled: true
discovery:
service-list-refresh-interval: 1000
logging:
level:
org.springframework.cloud.gateway: info

Loading…
Cancel
Save