update sentinel 1.8.3 => 1.8.4

2.X
疯狂的狮子Li 3 years ago
parent 98756eae3f
commit aafbad200e

@ -16,7 +16,7 @@
<properties>
<spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
<sentinel.version>1.8.3</sentinel.version>
<sentinel.version>1.8.4</sentinel.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<nacos.config.version>0.8.0</nacos.config.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>

@ -13,7 +13,7 @@
<packaging>jar</packaging>
<properties>
<sentinel.version>1.8.3</sentinel.version>
<sentinel.version>1.8.4</sentinel.version>
<resource.delimiter>@</resource.delimiter>
<curator.version>4.0.1</curator.version>
</properties>
@ -93,7 +93,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
<version>1.2.80</version>
</dependency>
</dependencies>

@ -15,39 +15,29 @@
*/
package com.alibaba.csp.sentinel.dashboard.controller;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import com.alibaba.csp.sentinel.dashboard.auth.AuthAction;
import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType;
import com.alibaba.csp.sentinel.dashboard.client.CommandNotFoundException;
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
import com.alibaba.csp.sentinel.dashboard.auth.AuthService;
import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
import com.alibaba.csp.sentinel.dashboard.domain.Result;
import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository;
import com.alibaba.csp.sentinel.dashboard.util.VersionUtils;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
/**
* @author Eric Zhao
@ -119,7 +109,7 @@ public class ParamFlowRuleController {
}
@PostMapping("/rule")
@AuthAction(AuthService.PrivilegeType.WRITE_RULE)
@AuthAction(PrivilegeType.WRITE_RULE)
public Result<ParamFlowRuleEntity> apiAddParamFlowRule(@RequestBody ParamFlowRuleEntity entity) {
Result<ParamFlowRuleEntity> checkResult = checkEntityInternal(entity);
if (checkResult != null) {
@ -188,7 +178,7 @@ public class ParamFlowRuleController {
}
@PutMapping("/rule/{id}")
@AuthAction(AuthService.PrivilegeType.WRITE_RULE)
@AuthAction(PrivilegeType.WRITE_RULE)
public Result<ParamFlowRuleEntity> apiUpdateParamFlowRule(@PathVariable("id") Long id,
@RequestBody ParamFlowRuleEntity entity) {
if (id == null || id <= 0) {

@ -15,33 +15,22 @@
*/
package com.alibaba.csp.sentinel.dashboard.controller.v2;
import java.util.Date;
import java.util.List;
import com.alibaba.csp.sentinel.dashboard.auth.AuthAction;
import com.alibaba.csp.sentinel.dashboard.auth.AuthService;
import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.domain.Result;
import com.alibaba.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.domain.Result;
import com.alibaba.csp.sentinel.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* Flow rule controller (v2).
@ -135,7 +124,7 @@ public class FlowControllerV2 {
}
@PostMapping("/rule")
@AuthAction(value = AuthService.PrivilegeType.WRITE_RULE)
@AuthAction(value = PrivilegeType.WRITE_RULE)
public Result<FlowRuleEntity> apiAddFlowRule(@RequestBody FlowRuleEntity entity) {
Result<FlowRuleEntity> checkResult = checkEntityInternal(entity);
@ -159,7 +148,7 @@ public class FlowControllerV2 {
}
@PutMapping("/rule/{id}")
@AuthAction(AuthService.PrivilegeType.WRITE_RULE)
@AuthAction(PrivilegeType.WRITE_RULE)
public Result<FlowRuleEntity> apiUpdateFlowRule(@PathVariable("id") Long id,
@RequestBody FlowRuleEntity entity) {

@ -23,8 +23,20 @@ package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api;
*/
public class ApiPredicateItemVo {
/**
* The pattern for matching url.
*/
private String pattern;
/**
* The matching Strategy in url. Constants are defined in class SentinelGatewayConstants.\
*
* <ul>
* <li>0(URL_MATCH_STRATEGY_EXACT): exact match mode</li>
* <li>1(URL_MATCH_STRATEGY_PREFIX): prefix match mode</li>
* <li>2(URL_MATCH_STRATEGY_REGEX): regex match mode</li>
* </ul>
*/
private Integer matchStrategy;
public String getPattern() {

@ -15,23 +15,13 @@
*/
package com.alibaba.csp.sentinel.dashboard.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ConnectionGroupVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.AppClusterClientStateWrapVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.AppClusterServerStateWrapVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterServerStateVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO;
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.*;
import com.alibaba.csp.sentinel.util.StringUtil;
import java.util.*;
/**
* @author Eric Zhao
@ -130,7 +120,8 @@ public final class ClusterEntityUtils {
if (mode == ClusterStateManager.CLUSTER_SERVER) {
String serverAddress = getIp(ip);
int port = stateVO.getState().getServer().getPort();
map.computeIfAbsent(serverAddress, v -> new ClusterGroupEntity()
String targetAddress = serverAddress + ":" + port;
map.computeIfAbsent(targetAddress, v -> new ClusterGroupEntity()
.setBelongToApp(true).setMachineId(ip + '@' + stateVO.getCommandPort())
.setIp(ip).setPort(port)
);
@ -145,8 +136,8 @@ public final class ClusterEntityUtils {
if (StringUtil.isBlank(targetServer) || targetPort == null || targetPort <= 0) {
continue;
}
ClusterGroupEntity group = map.computeIfAbsent(targetServer,
String targetAddress = targetServer + ":" + targetPort;
ClusterGroupEntity group = map.computeIfAbsent(targetAddress,
v -> new ClusterGroupEntity()
.setBelongToApp(true).setMachineId(targetServer)
.setIp(targetServer).setPort(targetPort)

@ -74,7 +74,7 @@ app.service('DegradeService', ['$http', function ($http) {
return false;
}
if (rule.statIntervalMs !== undefined && rule.statIntervalMs > 60 * 1000 * 2) {
alert('统计窗口时长不能超过 120 分钟');
alert('统计窗口时长最大 120s');
return false;
}
// 异常比率类型.

Loading…
Cancel
Save