mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-08 13:27:46 +00:00
update sentinel 1.8.6 => 1.8.8
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<sentinel.version>1.8.6</sentinel.version>
|
||||
<sentinel.version>1.8.8</sentinel.version>
|
||||
<curator.version>4.0.1</curator.version>
|
||||
<spring-boot.version>2.7.18</spring-boot.version>
|
||||
<spring-cloud.version>2021.0.7</spring-cloud.version>
|
||||
|
@@ -16,7 +16,6 @@
|
||||
package com.alibaba.csp.sentinel.dashboard;
|
||||
|
||||
import com.alibaba.csp.sentinel.init.InitExecutor;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@@ -15,11 +15,7 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.auth;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author lkxiaolou
|
||||
|
@@ -16,7 +16,6 @@
|
||||
package com.alibaba.csp.sentinel.dashboard.auth;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.config;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* <p>Dashboard local config support.</p>
|
||||
* <p>
|
||||
@@ -65,7 +65,7 @@ public class DashboardConfig {
|
||||
public static final String CONFIG_AUTO_REMOVE_MACHINE_MILLIS = "sentinel.dashboard.autoRemoveMachineMillis";
|
||||
|
||||
private static final ConcurrentMap<String, Object> cacheMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@NonNull
|
||||
private static String getConfig(String name) {
|
||||
// env
|
||||
@@ -121,19 +121,19 @@ public class DashboardConfig {
|
||||
public static int getHideAppNoMachineMillis() {
|
||||
return getConfigInt(CONFIG_HIDE_APP_NO_MACHINE_MILLIS, 0, 60000);
|
||||
}
|
||||
|
||||
|
||||
public static int getRemoveAppNoMachineMillis() {
|
||||
return getConfigInt(CONFIG_REMOVE_APP_NO_MACHINE_MILLIS, 0, 120000);
|
||||
}
|
||||
|
||||
|
||||
public static int getAutoRemoveMachineMillis() {
|
||||
return getConfigInt(CONFIG_AUTO_REMOVE_MACHINE_MILLIS, 0, 300000);
|
||||
}
|
||||
|
||||
|
||||
public static int getUnhealthyMachineMillis() {
|
||||
return getConfigInt(CONFIG_UNHEALTHY_MACHINE_MILLIS, DEFAULT_MACHINE_HEALTHY_TIMEOUT_MS, 30000);
|
||||
}
|
||||
|
||||
|
||||
public static void clearCache() {
|
||||
cacheMap.clear();
|
||||
}
|
||||
|
@@ -15,16 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.adapter.servlet.CommonFilter;
|
||||
import com.alibaba.csp.sentinel.adapter.servlet.callback.WebCallbackManager;
|
||||
import com.alibaba.csp.sentinel.dashboard.auth.AuthorizationInterceptor;
|
||||
import com.alibaba.csp.sentinel.dashboard.auth.LoginAuthenticationFilter;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +33,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.Filter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
|
@@ -15,24 +15,19 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
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.domain.vo.MachineInfoVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Carpenter Lee
|
||||
@@ -66,7 +61,7 @@ public class AppController {
|
||||
Collections.sort(list, Comparator.comparing(MachineInfo::getApp).thenComparing(MachineInfo::getIp).thenComparingInt(MachineInfo::getPort));
|
||||
return Result.ofSuccess(MachineInfoVo.fromMachineInfoList(list));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/{app}/machine/remove.json")
|
||||
public Result<String> removeMachineById(
|
||||
@PathVariable("app") String app,
|
||||
|
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.alibaba.csp.sentinel.Entry;
|
||||
import com.alibaba.csp.sentinel.EntryType;
|
||||
import com.alibaba.csp.sentinel.SphU;
|
||||
import com.alibaba.csp.sentinel.context.ContextUtil;
|
||||
import com.alibaba.csp.sentinel.slots.block.BlockException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -25,11 +27,8 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.alibaba.csp.sentinel.Entry;
|
||||
import com.alibaba.csp.sentinel.EntryType;
|
||||
import com.alibaba.csp.sentinel.SphU;
|
||||
import com.alibaba.csp.sentinel.context.ContextUtil;
|
||||
import com.alibaba.csp.sentinel.slots.block.BlockException;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/demo", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
@@ -16,11 +16,9 @@
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import org.apache.http.conn.util.InetAddressUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@@ -15,17 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.vo.MetricVo;
|
||||
import com.alibaba.csp.sentinel.dashboard.repository.metric.MetricsRepository;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,10 +28,8 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.vo.MetricVo;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
|
@@ -16,7 +16,6 @@
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
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.dashboard.client.CommandNotFoundException;
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
@@ -113,7 +112,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) {
|
||||
@@ -182,7 +181,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,17 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode;
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.vo.ResourceVo;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -33,6 +28,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Carpenter Lee
|
||||
*/
|
||||
|
@@ -17,7 +17,6 @@ package com.alibaba.csp.sentinel.dashboard.controller;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@@ -15,24 +15,19 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller.cluster;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppFullAssignRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppFullAssignRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppSingleServerAssignRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.service.ClusterAssignService;
|
||||
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.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
|
@@ -15,18 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.controller.cluster;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
|
||||
import com.alibaba.csp.sentinel.dashboard.client.CommandNotFoundException;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest;
|
||||
@@ -37,17 +30,17 @@ import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalS
|
||||
import com.alibaba.csp.sentinel.dashboard.service.ClusterConfigService;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.VersionUtils;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.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.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
|
@@ -37,9 +37,9 @@ import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.alibaba.csp.sentinel.slots.block.RuleConstant.*;
|
||||
import static com.alibaba.csp.sentinel.adapter.gateway.common.SentinelGatewayConstants.*;
|
||||
import static com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity.*;
|
||||
import static com.alibaba.csp.sentinel.slots.block.RuleConstant.*;
|
||||
|
||||
/**
|
||||
* Gateway flow rule Controller for manage gateway flow rules.
|
||||
|
@@ -16,7 +16,6 @@
|
||||
package com.alibaba.csp.sentinel.dashboard.controller.v2;
|
||||
|
||||
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.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
||||
@@ -125,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);
|
||||
@@ -149,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) {
|
||||
|
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.discovery;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.config.DashboardConfig;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MachineInfo implements Comparable<MachineInfo> {
|
||||
|
||||
private String app = "";
|
||||
@@ -90,7 +90,7 @@ public class MachineInfo implements Comparable<MachineInfo> {
|
||||
public long getHeartbeatVersion() {
|
||||
return heartbeatVersion;
|
||||
}
|
||||
|
||||
|
||||
public void setHeartbeatVersion(long heartbeatVersion) {
|
||||
this.heartbeatVersion = heartbeatVersion;
|
||||
}
|
||||
@@ -103,15 +103,15 @@ public class MachineInfo implements Comparable<MachineInfo> {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean isHealthy() {
|
||||
long delta = System.currentTimeMillis() - lastHeartbeat;
|
||||
return delta < DashboardConfig.getUnhealthyMachineMillis();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* whether dead should be removed
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isDead() {
|
||||
@@ -121,11 +121,11 @@ public class MachineInfo implements Comparable<MachineInfo> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public long getLastHeartbeat() {
|
||||
return lastHeartbeat;
|
||||
}
|
||||
|
||||
|
||||
public void setLastHeartbeat(long lastHeartbeat) {
|
||||
this.lastHeartbeat = lastHeartbeat;
|
||||
}
|
||||
|
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.discovery;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -22,10 +25,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain;
|
||||
|
||||
import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.cluster;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.1
|
||||
|
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.cluster;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.1
|
||||
|
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.cluster.request;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.0
|
||||
|
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.cluster.state;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ConnectionGroupVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.0
|
||||
|
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
@@ -91,15 +91,15 @@ public class MachineInfoVo {
|
||||
public long getLastHeartbeat() {
|
||||
return lastHeartbeat;
|
||||
}
|
||||
|
||||
|
||||
public void setLastHeartbeat(long lastHeartbeat) {
|
||||
this.lastHeartbeat = lastHeartbeat;
|
||||
}
|
||||
|
||||
|
||||
public void setHeartbeatVersion(long heartbeatVersion) {
|
||||
this.heartbeatVersion = heartbeatVersion;
|
||||
}
|
||||
|
||||
|
||||
public long getHeartbeatVersion() {
|
||||
return heartbeatVersion;
|
||||
}
|
||||
|
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class ApplicationEntity {
|
||||
|
||||
private Long id;
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
private String app;
|
||||
private Integer appType;
|
||||
private String activeConsole;
|
||||
private Date lastFetch;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public Integer getAppType() {
|
||||
return appType;
|
||||
}
|
||||
|
||||
public void setAppType(Integer appType) {
|
||||
this.appType = appType;
|
||||
}
|
||||
|
||||
public String getActiveConsole() {
|
||||
return activeConsole;
|
||||
}
|
||||
|
||||
public Date getLastFetch() {
|
||||
return lastFetch;
|
||||
}
|
||||
|
||||
public void setLastFetch(Date lastFetch) {
|
||||
this.lastFetch = lastFetch;
|
||||
}
|
||||
|
||||
public void setActiveConsole(String activeConsole) {
|
||||
this.activeConsole = activeConsole;
|
||||
}
|
||||
|
||||
public AppInfo toAppInfo() {
|
||||
return new AppInfo(app, appType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApplicationEntity{" +
|
||||
"id=" + id +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", app='" + app + '\'' +
|
||||
", activeConsole='" + activeConsole + '\'' +
|
||||
", lastFetch=" + lastFetch +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class MachineEntity {
|
||||
private Long id;
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
private String app;
|
||||
private String ip;
|
||||
private String hostname;
|
||||
private Date timestamp;
|
||||
private Integer port;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public Date getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Date timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public MachineInfo toMachineInfo() {
|
||||
MachineInfo machineInfo = new MachineInfo();
|
||||
|
||||
machineInfo.setApp(app);
|
||||
machineInfo.setHostname(hostname);
|
||||
machineInfo.setIp(ip);
|
||||
machineInfo.setPort(port);
|
||||
machineInfo.setLastHeartbeat(timestamp.getTime());
|
||||
machineInfo.setHeartbeatVersion(timestamp.getTime());
|
||||
|
||||
return machineInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MachineEntity{" +
|
||||
"id=" + id +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", app='" + app + '\'' +
|
||||
", ip='" + ip + '\'' +
|
||||
", hostname='" + hostname + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", port=" + port +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class MetricEntity {
|
||||
private Long id;
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
private String app;
|
||||
/**
|
||||
* 监控信息的时间戳
|
||||
*/
|
||||
private Date timestamp;
|
||||
private String resource;
|
||||
private Long passQps;
|
||||
private Long successQps;
|
||||
private Long blockQps;
|
||||
private Long exceptionQps;
|
||||
|
||||
/**
|
||||
* summary rt of all success exit qps.
|
||||
*/
|
||||
private double rt;
|
||||
|
||||
/**
|
||||
* 本次聚合的总条数
|
||||
*/
|
||||
private int count;
|
||||
|
||||
private int resourceCode;
|
||||
|
||||
public static MetricEntity copyOf(MetricEntity oldEntity) {
|
||||
MetricEntity entity = new MetricEntity();
|
||||
entity.setId(oldEntity.getId());
|
||||
entity.setGmtCreate(oldEntity.getGmtCreate());
|
||||
entity.setGmtModified(oldEntity.getGmtModified());
|
||||
entity.setApp(oldEntity.getApp());
|
||||
entity.setTimestamp(oldEntity.getTimestamp());
|
||||
entity.setResource(oldEntity.getResource());
|
||||
entity.setPassQps(oldEntity.getPassQps());
|
||||
entity.setBlockQps(oldEntity.getBlockQps());
|
||||
entity.setSuccessQps(oldEntity.getSuccessQps());
|
||||
entity.setExceptionQps(oldEntity.getExceptionQps());
|
||||
entity.setRt(oldEntity.getRt());
|
||||
entity.setCount(oldEntity.getCount());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public synchronized void addPassQps(Long passQps) {
|
||||
this.passQps += passQps;
|
||||
}
|
||||
|
||||
public synchronized void addBlockQps(Long blockQps) {
|
||||
this.blockQps += blockQps;
|
||||
}
|
||||
|
||||
public synchronized void addExceptionQps(Long exceptionQps) {
|
||||
this.exceptionQps += exceptionQps;
|
||||
}
|
||||
|
||||
public synchronized void addCount(int count) {
|
||||
this.count += count;
|
||||
}
|
||||
|
||||
public synchronized void addRtAndSuccessQps(double avgRt, Long successQps) {
|
||||
this.rt += avgRt * successQps;
|
||||
this.successQps += successQps;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link #rt} = {@code avgRt * successQps}
|
||||
*
|
||||
* @param avgRt average rt of {@code successQps}
|
||||
* @param successQps
|
||||
*/
|
||||
public synchronized void setRtAndSuccessQps(double avgRt, Long successQps) {
|
||||
this.rt = avgRt * successQps;
|
||||
this.successQps = successQps;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public Date getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Date timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
this.resourceCode = resource.hashCode();
|
||||
}
|
||||
|
||||
public Long getPassQps() {
|
||||
return passQps;
|
||||
}
|
||||
|
||||
public void setPassQps(Long passQps) {
|
||||
this.passQps = passQps;
|
||||
}
|
||||
|
||||
public Long getBlockQps() {
|
||||
return blockQps;
|
||||
}
|
||||
|
||||
public void setBlockQps(Long blockQps) {
|
||||
this.blockQps = blockQps;
|
||||
}
|
||||
|
||||
public Long getExceptionQps() {
|
||||
return exceptionQps;
|
||||
}
|
||||
|
||||
public void setExceptionQps(Long exceptionQps) {
|
||||
this.exceptionQps = exceptionQps;
|
||||
}
|
||||
|
||||
public double getRt() {
|
||||
return rt;
|
||||
}
|
||||
|
||||
public void setRt(double rt) {
|
||||
this.rt = rt;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public int getResourceCode() {
|
||||
return resourceCode;
|
||||
}
|
||||
|
||||
public Long getSuccessQps() {
|
||||
return successQps;
|
||||
}
|
||||
|
||||
public void setSuccessQps(Long successQps) {
|
||||
this.successQps = successQps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetricEntity{" +
|
||||
"id=" + id +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", app='" + app + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", resource='" + resource + '\'' +
|
||||
", passQps=" + passQps +
|
||||
", blockQps=" + blockQps +
|
||||
", successQps=" + successQps +
|
||||
", exceptionQps=" + exceptionQps +
|
||||
", rt=" + rt +
|
||||
", count=" + count +
|
||||
", resourceCode=" + resourceCode +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class MetricPositionEntity {
|
||||
private long id;
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
private String app;
|
||||
private String ip;
|
||||
/**
|
||||
* Sentinel在该应用上使用的端口
|
||||
*/
|
||||
private int port;
|
||||
|
||||
/**
|
||||
* 机器名,冗余字段
|
||||
*/
|
||||
private String hostname;
|
||||
|
||||
/**
|
||||
* 上一次拉取的最晚时间戳
|
||||
*/
|
||||
private Date lastFetch;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public Date getLastFetch() {
|
||||
return lastFetch;
|
||||
}
|
||||
|
||||
public void setLastFetch(Date lastFetch) {
|
||||
this.lastFetch = lastFetch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetricPositionEntity{" +
|
||||
"id=" + id +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", app='" + app + '\'' +
|
||||
", ip='" + ip + '\'' +
|
||||
", port=" + port +
|
||||
", hostname='" + hostname + '\'' +
|
||||
", lastFetch=" + lastFetch +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 0.2.1
|
||||
*/
|
||||
public class SentinelVersion {
|
||||
private int majorVersion;
|
||||
private int minorVersion;
|
||||
private int fixVersion;
|
||||
private String postfix;
|
||||
|
||||
public SentinelVersion() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public SentinelVersion(int major, int minor, int fix) {
|
||||
this(major, minor, fix, null);
|
||||
}
|
||||
|
||||
public SentinelVersion(int major, int minor, int fix, String postfix) {
|
||||
this.majorVersion = major;
|
||||
this.minorVersion = minor;
|
||||
this.fixVersion = fix;
|
||||
this.postfix = postfix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 000, 000, 000
|
||||
*/
|
||||
public int getFullVersion() {
|
||||
return majorVersion * 1000000 + minorVersion * 1000 + fixVersion;
|
||||
}
|
||||
|
||||
public int getMajorVersion() {
|
||||
return majorVersion;
|
||||
}
|
||||
|
||||
public SentinelVersion setMajorVersion(int majorVersion) {
|
||||
this.majorVersion = majorVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMinorVersion() {
|
||||
return minorVersion;
|
||||
}
|
||||
|
||||
public SentinelVersion setMinorVersion(int minorVersion) {
|
||||
this.minorVersion = minorVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getFixVersion() {
|
||||
return fixVersion;
|
||||
}
|
||||
|
||||
public SentinelVersion setFixVersion(int fixVersion) {
|
||||
this.fixVersion = fixVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPostfix() {
|
||||
return postfix;
|
||||
}
|
||||
|
||||
public SentinelVersion setPostfix(String postfix) {
|
||||
this.postfix = postfix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean greaterThan(SentinelVersion version) {
|
||||
if (version == null) {
|
||||
return true;
|
||||
}
|
||||
return getFullVersion() > version.getFullVersion();
|
||||
}
|
||||
|
||||
public boolean greaterOrEqual(SentinelVersion version) {
|
||||
if (version == null) {
|
||||
return true;
|
||||
}
|
||||
return getFullVersion() >= version.getFullVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) { return true; }
|
||||
if (o == null || getClass() != o.getClass()) { return false; }
|
||||
|
||||
SentinelVersion that = (SentinelVersion)o;
|
||||
|
||||
if (getFullVersion() != that.getFullVersion()) { return false; }
|
||||
return postfix != null ? postfix.equals(that.postfix) : that.postfix == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = majorVersion;
|
||||
result = 31 * result + minorVersion;
|
||||
result = 31 * result + fixVersion;
|
||||
result = 31 * result + (postfix != null ? postfix.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SentinelVersion{" +
|
||||
"majorVersion=" + majorVersion +
|
||||
", minorVersion=" + minorVersion +
|
||||
", fixVersion=" + fixVersion +
|
||||
", postfix='" + postfix + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.gateway;
|
||||
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPathPredicateItem;
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPredicateItem;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.Rule;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Entity for {@link ApiDefinition}.
|
||||
*
|
||||
* @author cdfive
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public class ApiDefinitionEntity implements RuleEntity {
|
||||
|
||||
private Long id;
|
||||
private String app;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
private String apiName;
|
||||
private Set<com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity> predicateItems;
|
||||
|
||||
public static ApiDefinitionEntity fromApiDefinition(String app, String ip, Integer port, ApiDefinition apiDefinition) {
|
||||
ApiDefinitionEntity entity = new ApiDefinitionEntity();
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
entity.setApiName(apiDefinition.getApiName());
|
||||
|
||||
Set<com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity> predicateItems = new LinkedHashSet<>();
|
||||
entity.setPredicateItems(predicateItems);
|
||||
|
||||
Set<ApiPredicateItem> apiPredicateItems = apiDefinition.getPredicateItems();
|
||||
if (apiPredicateItems != null) {
|
||||
for (ApiPredicateItem apiPredicateItem : apiPredicateItems) {
|
||||
com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity itemEntity = new com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity();
|
||||
predicateItems.add(itemEntity);
|
||||
ApiPathPredicateItem pathPredicateItem = (ApiPathPredicateItem) apiPredicateItem;
|
||||
itemEntity.setPattern(pathPredicateItem.getPattern());
|
||||
itemEntity.setMatchStrategy(pathPredicateItem.getMatchStrategy());
|
||||
}
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public ApiDefinition toApiDefinition() {
|
||||
ApiDefinition apiDefinition = new ApiDefinition();
|
||||
apiDefinition.setApiName(apiName);
|
||||
|
||||
Set<ApiPredicateItem> apiPredicateItems = new LinkedHashSet<>();
|
||||
apiDefinition.setPredicateItems(apiPredicateItems);
|
||||
|
||||
if (predicateItems != null) {
|
||||
for (com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity predicateItem : predicateItems) {
|
||||
ApiPathPredicateItem apiPredicateItem = new ApiPathPredicateItem();
|
||||
apiPredicateItems.add(apiPredicateItem);
|
||||
apiPredicateItem.setMatchStrategy(predicateItem.getMatchStrategy());
|
||||
apiPredicateItem.setPattern(predicateItem.getPattern());
|
||||
}
|
||||
}
|
||||
|
||||
return apiDefinition;
|
||||
}
|
||||
|
||||
public ApiDefinitionEntity() {
|
||||
|
||||
}
|
||||
|
||||
public ApiDefinitionEntity(String apiName, Set<com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity> predicateItems) {
|
||||
this.apiName = apiName;
|
||||
this.predicateItems = predicateItems;
|
||||
}
|
||||
|
||||
public String getApiName() {
|
||||
return apiName;
|
||||
}
|
||||
|
||||
public void setApiName(String apiName) {
|
||||
this.apiName = apiName;
|
||||
}
|
||||
|
||||
public Set<com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity> getPredicateItems() {
|
||||
return predicateItems;
|
||||
}
|
||||
|
||||
public void setPredicateItems(Set<ApiPredicateItemEntity> predicateItems) {
|
||||
this.predicateItems = predicateItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rule toRule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) { return true; }
|
||||
if (o == null || getClass() != o.getClass()) { return false; }
|
||||
ApiDefinitionEntity entity = (ApiDefinitionEntity) o;
|
||||
return Objects.equals(id, entity.id) &&
|
||||
Objects.equals(app, entity.app) &&
|
||||
Objects.equals(ip, entity.ip) &&
|
||||
Objects.equals(port, entity.port) &&
|
||||
Objects.equals(gmtCreate, entity.gmtCreate) &&
|
||||
Objects.equals(gmtModified, entity.gmtModified) &&
|
||||
Objects.equals(apiName, entity.apiName) &&
|
||||
Objects.equals(predicateItems, entity.predicateItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, app, ip, port, gmtCreate, gmtModified, apiName, predicateItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiDefinitionEntity{" +
|
||||
"id=" + id +
|
||||
", app='" + app + '\'' +
|
||||
", ip='" + ip + '\'' +
|
||||
", port=" + port +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", apiName='" + apiName + '\'' +
|
||||
", predicateItems=" + predicateItems +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.gateway;
|
||||
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPredicateItem;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Entity for {@link ApiPredicateItem}.
|
||||
*
|
||||
* @author cdfive
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public class ApiPredicateItemEntity {
|
||||
|
||||
private String pattern;
|
||||
|
||||
private Integer matchStrategy;
|
||||
|
||||
public ApiPredicateItemEntity() {
|
||||
}
|
||||
|
||||
public ApiPredicateItemEntity(String pattern, int matchStrategy) {
|
||||
this.pattern = pattern;
|
||||
this.matchStrategy = matchStrategy;
|
||||
}
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public void setPattern(String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public Integer getMatchStrategy() {
|
||||
return matchStrategy;
|
||||
}
|
||||
|
||||
public void setMatchStrategy(Integer matchStrategy) {
|
||||
this.matchStrategy = matchStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) { return true; }
|
||||
if (o == null || getClass() != o.getClass()) { return false; }
|
||||
ApiPredicateItemEntity that = (ApiPredicateItemEntity) o;
|
||||
return Objects.equals(pattern, that.pattern) &&
|
||||
Objects.equals(matchStrategy, that.matchStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(pattern, matchStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiPredicateItemEntity{" +
|
||||
"pattern='" + pattern + '\'' +
|
||||
", matchStrategy=" + matchStrategy +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,355 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.gateway;
|
||||
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayParamFlowItemEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.Rule;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Entity for {@link GatewayFlowRule}.
|
||||
*
|
||||
* @author cdfive
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public class GatewayFlowRuleEntity implements RuleEntity {
|
||||
|
||||
/**间隔单位*/
|
||||
/**0-秒*/
|
||||
public static final int INTERVAL_UNIT_SECOND = 0;
|
||||
/**1-分*/
|
||||
public static final int INTERVAL_UNIT_MINUTE = 1;
|
||||
/**2-时*/
|
||||
public static final int INTERVAL_UNIT_HOUR = 2;
|
||||
/**3-天*/
|
||||
public static final int INTERVAL_UNIT_DAY = 3;
|
||||
|
||||
private Long id;
|
||||
private String app;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
private String resource;
|
||||
private Integer resourceMode;
|
||||
|
||||
private Integer grade;
|
||||
private Double count;
|
||||
private Long interval;
|
||||
private Integer intervalUnit;
|
||||
|
||||
private Integer controlBehavior;
|
||||
private Integer burst;
|
||||
|
||||
private Integer maxQueueingTimeoutMs;
|
||||
|
||||
private GatewayParamFlowItemEntity paramItem;
|
||||
|
||||
public static Long calIntervalSec(Long interval, Integer intervalUnit) {
|
||||
switch (intervalUnit) {
|
||||
case INTERVAL_UNIT_SECOND:
|
||||
return interval;
|
||||
case INTERVAL_UNIT_MINUTE:
|
||||
return interval * 60;
|
||||
case INTERVAL_UNIT_HOUR:
|
||||
return interval * 60 * 60;
|
||||
case INTERVAL_UNIT_DAY:
|
||||
return interval * 60 * 60 * 24;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Invalid intervalUnit: " + intervalUnit);
|
||||
}
|
||||
|
||||
public static Object[] parseIntervalSec(Long intervalSec) {
|
||||
if (intervalSec % (60 * 60 * 24) == 0) {
|
||||
return new Object[] {intervalSec / (60 * 60 * 24), INTERVAL_UNIT_DAY};
|
||||
}
|
||||
|
||||
if (intervalSec % (60 * 60 ) == 0) {
|
||||
return new Object[] {intervalSec / (60 * 60), INTERVAL_UNIT_HOUR};
|
||||
}
|
||||
|
||||
if (intervalSec % 60 == 0) {
|
||||
return new Object[] {intervalSec / 60, INTERVAL_UNIT_MINUTE};
|
||||
}
|
||||
|
||||
return new Object[] {intervalSec, INTERVAL_UNIT_SECOND};
|
||||
}
|
||||
|
||||
public GatewayFlowRule toGatewayFlowRule() {
|
||||
GatewayFlowRule rule = new GatewayFlowRule();
|
||||
rule.setResource(resource);
|
||||
rule.setResourceMode(resourceMode);
|
||||
|
||||
rule.setGrade(grade);
|
||||
rule.setCount(count);
|
||||
rule.setIntervalSec(calIntervalSec(interval, intervalUnit));
|
||||
|
||||
rule.setControlBehavior(controlBehavior);
|
||||
|
||||
if (burst != null) {
|
||||
rule.setBurst(burst);
|
||||
}
|
||||
|
||||
if (maxQueueingTimeoutMs != null) {
|
||||
rule.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs);
|
||||
}
|
||||
|
||||
if (paramItem != null) {
|
||||
GatewayParamFlowItem ruleItem = new GatewayParamFlowItem();
|
||||
rule.setParamItem(ruleItem);
|
||||
ruleItem.setParseStrategy(paramItem.getParseStrategy());
|
||||
ruleItem.setFieldName(paramItem.getFieldName());
|
||||
ruleItem.setPattern(paramItem.getPattern());
|
||||
|
||||
if (paramItem.getMatchStrategy() != null) {
|
||||
ruleItem.setMatchStrategy(paramItem.getMatchStrategy());
|
||||
}
|
||||
}
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
public static GatewayFlowRuleEntity fromGatewayFlowRule(String app, String ip, Integer port, GatewayFlowRule rule) {
|
||||
GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity();
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
|
||||
entity.setResource(rule.getResource());
|
||||
entity.setResourceMode(rule.getResourceMode());
|
||||
|
||||
entity.setGrade(rule.getGrade());
|
||||
entity.setCount(rule.getCount());
|
||||
Object[] intervalSecResult = parseIntervalSec(rule.getIntervalSec());
|
||||
entity.setInterval((Long) intervalSecResult[0]);
|
||||
entity.setIntervalUnit((Integer) intervalSecResult[1]);
|
||||
|
||||
entity.setControlBehavior(rule.getControlBehavior());
|
||||
entity.setBurst(rule.getBurst());
|
||||
entity.setMaxQueueingTimeoutMs(rule.getMaxQueueingTimeoutMs());
|
||||
|
||||
GatewayParamFlowItem paramItem = rule.getParamItem();
|
||||
if (paramItem != null) {
|
||||
GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity();
|
||||
entity.setParamItem(itemEntity);
|
||||
itemEntity.setParseStrategy(paramItem.getParseStrategy());
|
||||
itemEntity.setFieldName(paramItem.getFieldName());
|
||||
itemEntity.setPattern(paramItem.getPattern());
|
||||
itemEntity.setMatchStrategy(paramItem.getMatchStrategy());
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rule toRule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public GatewayParamFlowItemEntity getParamItem() {
|
||||
return paramItem;
|
||||
}
|
||||
|
||||
public void setParamItem(GatewayParamFlowItemEntity paramItem) {
|
||||
this.paramItem = paramItem;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public Integer getResourceMode() {
|
||||
return resourceMode;
|
||||
}
|
||||
|
||||
public void setResourceMode(Integer resourceMode) {
|
||||
this.resourceMode = resourceMode;
|
||||
}
|
||||
|
||||
public Integer getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setGrade(Integer grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
public Double getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Double count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Long getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public void setInterval(Long interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
public Integer getIntervalUnit() {
|
||||
return intervalUnit;
|
||||
}
|
||||
|
||||
public void setIntervalUnit(Integer intervalUnit) {
|
||||
this.intervalUnit = intervalUnit;
|
||||
}
|
||||
|
||||
public Integer getControlBehavior() {
|
||||
return controlBehavior;
|
||||
}
|
||||
|
||||
public void setControlBehavior(Integer controlBehavior) {
|
||||
this.controlBehavior = controlBehavior;
|
||||
}
|
||||
|
||||
public Integer getBurst() {
|
||||
return burst;
|
||||
}
|
||||
|
||||
public void setBurst(Integer burst) {
|
||||
this.burst = burst;
|
||||
}
|
||||
|
||||
public Integer getMaxQueueingTimeoutMs() {
|
||||
return maxQueueingTimeoutMs;
|
||||
}
|
||||
|
||||
public void setMaxQueueingTimeoutMs(Integer maxQueueingTimeoutMs) {
|
||||
this.maxQueueingTimeoutMs = maxQueueingTimeoutMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) { return true; }
|
||||
if (o == null || getClass() != o.getClass()) { return false; }
|
||||
GatewayFlowRuleEntity that = (GatewayFlowRuleEntity) o;
|
||||
return Objects.equals(id, that.id) &&
|
||||
Objects.equals(app, that.app) &&
|
||||
Objects.equals(ip, that.ip) &&
|
||||
Objects.equals(port, that.port) &&
|
||||
Objects.equals(gmtCreate, that.gmtCreate) &&
|
||||
Objects.equals(gmtModified, that.gmtModified) &&
|
||||
Objects.equals(resource, that.resource) &&
|
||||
Objects.equals(resourceMode, that.resourceMode) &&
|
||||
Objects.equals(grade, that.grade) &&
|
||||
Objects.equals(count, that.count) &&
|
||||
Objects.equals(interval, that.interval) &&
|
||||
Objects.equals(intervalUnit, that.intervalUnit) &&
|
||||
Objects.equals(controlBehavior, that.controlBehavior) &&
|
||||
Objects.equals(burst, that.burst) &&
|
||||
Objects.equals(maxQueueingTimeoutMs, that.maxQueueingTimeoutMs) &&
|
||||
Objects.equals(paramItem, that.paramItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, app, ip, port, gmtCreate, gmtModified, resource, resourceMode, grade, count, interval, intervalUnit, controlBehavior, burst, maxQueueingTimeoutMs, paramItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GatewayFlowRuleEntity{" +
|
||||
"id=" + id +
|
||||
", app='" + app + '\'' +
|
||||
", ip='" + ip + '\'' +
|
||||
", port=" + port +
|
||||
", gmtCreate=" + gmtCreate +
|
||||
", gmtModified=" + gmtModified +
|
||||
", resource='" + resource + '\'' +
|
||||
", resourceMode=" + resourceMode +
|
||||
", grade=" + grade +
|
||||
", count=" + count +
|
||||
", interval=" + interval +
|
||||
", intervalUnit=" + intervalUnit +
|
||||
", controlBehavior=" + controlBehavior +
|
||||
", burst=" + burst +
|
||||
", maxQueueingTimeoutMs=" + maxQueueingTimeoutMs +
|
||||
", paramItem=" + paramItem +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.gateway;
|
||||
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Entity for {@link GatewayParamFlowItem}.
|
||||
*
|
||||
* @author cdfive
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public class GatewayParamFlowItemEntity {
|
||||
|
||||
private Integer parseStrategy;
|
||||
|
||||
private String fieldName;
|
||||
|
||||
private String pattern;
|
||||
|
||||
private Integer matchStrategy;
|
||||
|
||||
public Integer getParseStrategy() {
|
||||
return parseStrategy;
|
||||
}
|
||||
|
||||
public void setParseStrategy(Integer parseStrategy) {
|
||||
this.parseStrategy = parseStrategy;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public void setPattern(String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public Integer getMatchStrategy() {
|
||||
return matchStrategy;
|
||||
}
|
||||
|
||||
public void setMatchStrategy(Integer matchStrategy) {
|
||||
this.matchStrategy = matchStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) { return true; }
|
||||
if (o == null || getClass() != o.getClass()) { return false; }
|
||||
GatewayParamFlowItemEntity that = (GatewayParamFlowItemEntity) o;
|
||||
return Objects.equals(parseStrategy, that.parseStrategy) &&
|
||||
Objects.equals(fieldName, that.fieldName) &&
|
||||
Objects.equals(pattern, that.pattern) &&
|
||||
Objects.equals(matchStrategy, that.matchStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(parseStrategy, fieldName, pattern, matchStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GatewayParamFlowItemEntity{" +
|
||||
"parseStrategy=" + parseStrategy +
|
||||
", fieldName='" + fieldName + '\'' +
|
||||
", pattern='" + pattern + '\'' +
|
||||
", matchStrategy=" + matchStrategy +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.AbstractRule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 0.2.1
|
||||
*/
|
||||
public abstract class AbstractRuleEntity<T extends AbstractRule> implements RuleEntity {
|
||||
|
||||
protected Long id;
|
||||
|
||||
protected String app;
|
||||
protected String ip;
|
||||
protected Integer port;
|
||||
|
||||
protected T rule;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setApp(String app) {
|
||||
this.app = app;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setIp(String ip) {
|
||||
this.ip = ip;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setPort(Integer port) {
|
||||
this.port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setRule(T rule) {
|
||||
this.rule = rule;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public AbstractRuleEntity<T> setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T toRule() {
|
||||
return rule;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.AbstractRuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 0.2.1
|
||||
*/
|
||||
public class AuthorityRuleEntity extends AbstractRuleEntity<AuthorityRule> {
|
||||
|
||||
public AuthorityRuleEntity() {
|
||||
}
|
||||
|
||||
public AuthorityRuleEntity(AuthorityRule authorityRule) {
|
||||
AssertUtil.notNull(authorityRule, "Authority rule should not be null");
|
||||
this.rule = authorityRule;
|
||||
}
|
||||
|
||||
public static AuthorityRuleEntity fromAuthorityRule(String app, String ip, Integer port, AuthorityRule rule) {
|
||||
AuthorityRuleEntity entity = new AuthorityRuleEntity(rule);
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public String getLimitApp() {
|
||||
return rule.getLimitApp();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public String getResource() {
|
||||
return rule.getResource();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public int getStrategy() {
|
||||
return rule.getStrategy();
|
||||
}
|
||||
}
|
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class DegradeRuleEntity implements RuleEntity {
|
||||
|
||||
private Long id;
|
||||
private String app;
|
||||
|
||||
private String ip;
|
||||
private Integer port;
|
||||
|
||||
private String resource;
|
||||
private String limitApp;
|
||||
private Double count;
|
||||
private Integer timeWindow;
|
||||
private Integer grade;
|
||||
private Integer minRequestAmount;
|
||||
private Double slowRatioThreshold;
|
||||
private Integer statIntervalMs;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
public static DegradeRuleEntity fromDegradeRule(String app, String ip, Integer port, DegradeRule rule) {
|
||||
DegradeRuleEntity entity = new DegradeRuleEntity();
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
entity.setResource(rule.getResource());
|
||||
entity.setLimitApp(rule.getLimitApp());
|
||||
entity.setCount(rule.getCount());
|
||||
entity.setTimeWindow(rule.getTimeWindow());
|
||||
entity.setGrade(rule.getGrade());
|
||||
entity.setMinRequestAmount(rule.getMinRequestAmount());
|
||||
entity.setSlowRatioThreshold(rule.getSlowRatioThreshold());
|
||||
entity.setStatIntervalMs(rule.getStatIntervalMs());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public String getLimitApp() {
|
||||
return limitApp;
|
||||
}
|
||||
|
||||
public void setLimitApp(String limitApp) {
|
||||
this.limitApp = limitApp;
|
||||
}
|
||||
|
||||
public Double getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Double count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getTimeWindow() {
|
||||
return timeWindow;
|
||||
}
|
||||
|
||||
public void setTimeWindow(Integer timeWindow) {
|
||||
this.timeWindow = timeWindow;
|
||||
}
|
||||
|
||||
public Integer getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setGrade(Integer grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
public Integer getMinRequestAmount() {
|
||||
return minRequestAmount;
|
||||
}
|
||||
|
||||
public DegradeRuleEntity setMinRequestAmount(Integer minRequestAmount) {
|
||||
this.minRequestAmount = minRequestAmount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getSlowRatioThreshold() {
|
||||
return slowRatioThreshold;
|
||||
}
|
||||
|
||||
public DegradeRuleEntity setSlowRatioThreshold(Double slowRatioThreshold) {
|
||||
this.slowRatioThreshold = slowRatioThreshold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatIntervalMs() {
|
||||
return statIntervalMs;
|
||||
}
|
||||
|
||||
public DegradeRuleEntity setStatIntervalMs(Integer statIntervalMs) {
|
||||
this.statIntervalMs = statIntervalMs;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DegradeRule toRule() {
|
||||
DegradeRule rule = new DegradeRule();
|
||||
rule.setResource(resource);
|
||||
rule.setLimitApp(limitApp);
|
||||
rule.setCount(count);
|
||||
rule.setTimeWindow(timeWindow);
|
||||
rule.setGrade(grade);
|
||||
if (minRequestAmount != null) {
|
||||
rule.setMinRequestAmount(minRequestAmount);
|
||||
}
|
||||
if (slowRatioThreshold != null) {
|
||||
rule.setSlowRatioThreshold(slowRatioThreshold);
|
||||
}
|
||||
if (statIntervalMs != null) {
|
||||
rule.setStatIntervalMs(statIntervalMs);
|
||||
}
|
||||
|
||||
return rule;
|
||||
}
|
||||
}
|
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.ClusterFlowConfig;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class FlowRuleEntity implements RuleEntity {
|
||||
|
||||
private Long id;
|
||||
private String app;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private String limitApp;
|
||||
private String resource;
|
||||
/**
|
||||
* 0为线程数;1为qps
|
||||
*/
|
||||
private Integer grade;
|
||||
private Double count;
|
||||
/**
|
||||
* 0为直接限流;1为关联限流;2为链路限流
|
||||
***/
|
||||
private Integer strategy;
|
||||
private String refResource;
|
||||
/**
|
||||
* 0. default, 1. warm up, 2. rate limiter
|
||||
*/
|
||||
private Integer controlBehavior;
|
||||
private Integer warmUpPeriodSec;
|
||||
/**
|
||||
* max queueing time in rate limiter behavior
|
||||
*/
|
||||
private Integer maxQueueingTimeMs;
|
||||
|
||||
private boolean clusterMode;
|
||||
/**
|
||||
* Flow rule config for cluster mode.
|
||||
*/
|
||||
private ClusterFlowConfig clusterConfig;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
public static FlowRuleEntity fromFlowRule(String app, String ip, Integer port, FlowRule rule) {
|
||||
FlowRuleEntity entity = new FlowRuleEntity();
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
entity.setLimitApp(rule.getLimitApp());
|
||||
entity.setResource(rule.getResource());
|
||||
entity.setGrade(rule.getGrade());
|
||||
entity.setCount(rule.getCount());
|
||||
entity.setStrategy(rule.getStrategy());
|
||||
entity.setRefResource(rule.getRefResource());
|
||||
entity.setControlBehavior(rule.getControlBehavior());
|
||||
entity.setWarmUpPeriodSec(rule.getWarmUpPeriodSec());
|
||||
entity.setMaxQueueingTimeMs(rule.getMaxQueueingTimeMs());
|
||||
entity.setClusterMode(rule.isClusterMode());
|
||||
entity.setClusterConfig(rule.getClusterConfig());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLimitApp() {
|
||||
return limitApp;
|
||||
}
|
||||
|
||||
public void setLimitApp(String limitApp) {
|
||||
this.limitApp = limitApp;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public Integer getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setGrade(Integer grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
public Double getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Double count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public void setStrategy(Integer strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public String getRefResource() {
|
||||
return refResource;
|
||||
}
|
||||
|
||||
public void setRefResource(String refResource) {
|
||||
this.refResource = refResource;
|
||||
}
|
||||
|
||||
public Integer getControlBehavior() {
|
||||
return controlBehavior;
|
||||
}
|
||||
|
||||
public void setControlBehavior(Integer controlBehavior) {
|
||||
this.controlBehavior = controlBehavior;
|
||||
}
|
||||
|
||||
public Integer getWarmUpPeriodSec() {
|
||||
return warmUpPeriodSec;
|
||||
}
|
||||
|
||||
public void setWarmUpPeriodSec(Integer warmUpPeriodSec) {
|
||||
this.warmUpPeriodSec = warmUpPeriodSec;
|
||||
}
|
||||
|
||||
public Integer getMaxQueueingTimeMs() {
|
||||
return maxQueueingTimeMs;
|
||||
}
|
||||
|
||||
public void setMaxQueueingTimeMs(Integer maxQueueingTimeMs) {
|
||||
this.maxQueueingTimeMs = maxQueueingTimeMs;
|
||||
}
|
||||
|
||||
public boolean isClusterMode() {
|
||||
return clusterMode;
|
||||
}
|
||||
|
||||
public FlowRuleEntity setClusterMode(boolean clusterMode) {
|
||||
this.clusterMode = clusterMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterFlowConfig getClusterConfig() {
|
||||
return clusterConfig;
|
||||
}
|
||||
|
||||
public FlowRuleEntity setClusterConfig(ClusterFlowConfig clusterConfig) {
|
||||
this.clusterConfig = clusterConfig;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowRule toRule() {
|
||||
FlowRule flowRule = new FlowRule();
|
||||
flowRule.setCount(this.count);
|
||||
flowRule.setGrade(this.grade);
|
||||
flowRule.setResource(this.resource);
|
||||
flowRule.setLimitApp(this.limitApp);
|
||||
flowRule.setRefResource(this.refResource);
|
||||
flowRule.setStrategy(this.strategy);
|
||||
if (this.controlBehavior != null) {
|
||||
flowRule.setControlBehavior(controlBehavior);
|
||||
}
|
||||
if (this.warmUpPeriodSec != null) {
|
||||
flowRule.setWarmUpPeriodSec(warmUpPeriodSec);
|
||||
}
|
||||
if (this.maxQueueingTimeMs != null) {
|
||||
flowRule.setMaxQueueingTimeMs(maxQueueingTimeMs);
|
||||
}
|
||||
flowRule.setClusterMode(clusterMode);
|
||||
flowRule.setClusterConfig(clusterConfig);
|
||||
return flowRule;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.AbstractRuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowClusterConfig;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowItem;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 0.2.1
|
||||
*/
|
||||
public class ParamFlowRuleEntity extends AbstractRuleEntity<ParamFlowRule> {
|
||||
|
||||
public ParamFlowRuleEntity() {
|
||||
}
|
||||
|
||||
public ParamFlowRuleEntity(ParamFlowRule rule) {
|
||||
AssertUtil.notNull(rule, "Authority rule should not be null");
|
||||
this.rule = rule;
|
||||
}
|
||||
|
||||
public static ParamFlowRuleEntity fromParamFlowRule(String app, String ip, Integer port, ParamFlowRule rule) {
|
||||
ParamFlowRuleEntity entity = new ParamFlowRuleEntity(rule);
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public String getLimitApp() {
|
||||
return rule.getLimitApp();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public String getResource() {
|
||||
return rule.getResource();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public int getGrade() {
|
||||
return rule.getGrade();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public Integer getParamIdx() {
|
||||
return rule.getParamIdx();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public double getCount() {
|
||||
return rule.getCount();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public List<ParamFlowItem> getParamFlowItemList() {
|
||||
return rule.getParamFlowItemList();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public int getControlBehavior() {
|
||||
return rule.getControlBehavior();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public int getMaxQueueingTimeMs() {
|
||||
return rule.getMaxQueueingTimeMs();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public int getBurstCount() {
|
||||
return rule.getBurstCount();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public long getDurationInSec() {
|
||||
return rule.getDurationInSec();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public boolean isClusterMode() {
|
||||
return rule.isClusterMode();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JSONField(serialize = false)
|
||||
public ParamFlowClusterConfig getClusterConfig() {
|
||||
return rule.getClusterConfig();
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.slots.block.Rule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public interface RuleEntity {
|
||||
|
||||
Long getId();
|
||||
|
||||
void setId(Long id);
|
||||
|
||||
String getApp();
|
||||
|
||||
String getIp();
|
||||
|
||||
Integer getPort();
|
||||
|
||||
Date getGmtCreate();
|
||||
|
||||
Rule toRule();
|
||||
}
|
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.alibaba.csp.sentinel.dashboard.entity.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.system.SystemRule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
public class SystemRuleEntity implements RuleEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String app;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private Double highestSystemLoad;
|
||||
private Long avgRt;
|
||||
private Long maxThread;
|
||||
private Double qps;
|
||||
private Double highestCpuUsage;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
public static SystemRuleEntity fromSystemRule(String app, String ip, Integer port, SystemRule rule) {
|
||||
SystemRuleEntity entity = new SystemRuleEntity();
|
||||
entity.setApp(app);
|
||||
entity.setIp(ip);
|
||||
entity.setPort(port);
|
||||
entity.setHighestSystemLoad(rule.getHighestSystemLoad());
|
||||
entity.setHighestCpuUsage(rule.getHighestCpuUsage());
|
||||
entity.setAvgRt(rule.getAvgRt());
|
||||
entity.setMaxThread(rule.getMaxThread());
|
||||
entity.setQps(rule.getQps());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public Double getHighestSystemLoad() {
|
||||
return highestSystemLoad;
|
||||
}
|
||||
|
||||
public void setHighestSystemLoad(Double highestSystemLoad) {
|
||||
this.highestSystemLoad = highestSystemLoad;
|
||||
}
|
||||
|
||||
public Long getAvgRt() {
|
||||
return avgRt;
|
||||
}
|
||||
|
||||
public void setAvgRt(Long avgRt) {
|
||||
this.avgRt = avgRt;
|
||||
}
|
||||
|
||||
public Long getMaxThread() {
|
||||
return maxThread;
|
||||
}
|
||||
|
||||
public void setMaxThread(Long maxThread) {
|
||||
this.maxThread = maxThread;
|
||||
}
|
||||
|
||||
public Double getQps() {
|
||||
return qps;
|
||||
}
|
||||
|
||||
public void setQps(Double qps) {
|
||||
this.qps = qps;
|
||||
}
|
||||
|
||||
public Double getHighestCpuUsage() {
|
||||
return highestCpuUsage;
|
||||
}
|
||||
|
||||
public void setHighestCpuUsage(Double highestCpuUsage) {
|
||||
this.highestCpuUsage = highestCpuUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemRule toRule() {
|
||||
SystemRule rule = new SystemRule();
|
||||
rule.setHighestSystemLoad(highestSystemLoad);
|
||||
rule.setAvgRt(avgRt);
|
||||
rule.setMaxThread(maxThread);
|
||||
rule.setQps(qps);
|
||||
rule.setHighestCpuUsage(highestCpuUsage);
|
||||
return rule;
|
||||
}
|
||||
}
|
@@ -15,26 +15,6 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.metric;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.Constants;
|
||||
import com.alibaba.csp.sentinel.concurrent.NamedThreadFactory;
|
||||
import com.alibaba.csp.sentinel.config.SentinelConfig;
|
||||
@@ -42,10 +22,9 @@ import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.dashboard.repository.metric.MetricsRepository;
|
||||
import com.alibaba.csp.sentinel.node.metric.MetricNode;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.repository.metric.MetricsRepository;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.concurrent.FutureCallback;
|
||||
@@ -61,6 +40,14 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* Fetch metric of machines.
|
||||
*
|
||||
|
@@ -20,11 +20,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.csp.sentinel.util.TimeUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.AuthorityRuleEntity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* In-memory storage for authority rules.
|
||||
*
|
||||
|
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.ClusterFlowConfig;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* Store {@link FlowRuleEntity} in memory.
|
||||
*
|
||||
|
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowClusterConfig;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 0.2.1
|
||||
|
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,15 +15,15 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
*/
|
||||
|
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.repository.rule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface to store and find rules.
|
||||
*
|
||||
|
@@ -15,20 +15,18 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.rule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
*/
|
||||
|
@@ -15,18 +15,17 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.rule;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.0
|
||||
|
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.1
|
||||
|
@@ -15,21 +15,7 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
import com.alibaba.csp.sentinel.util.function.Tuple2;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity;
|
||||
@@ -37,12 +23,21 @@ import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientCon
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.MachineUtils;
|
||||
import com.alibaba.csp.sentinel.util.AssertUtil;
|
||||
import com.alibaba.csp.sentinel.util.function.Tuple2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.1
|
||||
|
@@ -15,32 +15,31 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.service;
|
||||
|
||||
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.AsyncUtils;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
|
||||
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.AsyncUtils;
|
||||
import com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.0
|
||||
|
@@ -15,15 +15,15 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
* @since 1.4.1
|
||||
|
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.util;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.csp.sentinel.util.function.Tuple2;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Eric Zhao
|
||||
*/
|
||||
|
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
package com.alibaba.csp.sentinel.dashboard.util;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Util class for parsing version.
|
||||
@@ -43,7 +42,7 @@ public final class VersionUtils {
|
||||
try {
|
||||
String versionFull = verStr;
|
||||
SentinelVersion version = new SentinelVersion();
|
||||
|
||||
|
||||
// postfix
|
||||
int index = versionFull.indexOf("-");
|
||||
if (index == 0) {
|
||||
@@ -55,11 +54,11 @@ public final class VersionUtils {
|
||||
} else if (index > 0) {
|
||||
version.setPostfix(versionFull.substring(index + 1));
|
||||
}
|
||||
|
||||
|
||||
if (index >= 0) {
|
||||
versionFull = versionFull.substring(0, index);
|
||||
}
|
||||
|
||||
|
||||
// x.x.x
|
||||
int segment = 0;
|
||||
int[] ver = new int[3];
|
||||
@@ -75,7 +74,7 @@ public final class VersionUtils {
|
||||
versionFull = versionFull.substring(index + 1);
|
||||
segment ++;
|
||||
}
|
||||
|
||||
|
||||
if (ver[0] < 1) {
|
||||
// Wrong format, return empty.
|
||||
return Optional.empty();
|
||||
|
@@ -12,22 +12,22 @@
|
||||
|
||||
## Install Packages
|
||||
|
||||
```
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
## Start Development
|
||||
|
||||
```
|
||||
```shell
|
||||
npm start
|
||||
```
|
||||
|
||||
## Build for production
|
||||
|
||||
```
|
||||
```shell
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Credit
|
||||
|
||||
- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular)
|
||||
- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular)
|
||||
|
@@ -12,22 +12,22 @@
|
||||
|
||||
## 安装依赖
|
||||
|
||||
```
|
||||
```shell
|
||||
npm i
|
||||
```
|
||||
|
||||
## 开始本地开发
|
||||
|
||||
```
|
||||
```shell
|
||||
npm start
|
||||
```
|
||||
|
||||
## 构建前端资源
|
||||
|
||||
```
|
||||
```shell
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Credit
|
||||
|
||||
- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular)
|
||||
- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular)
|
||||
|
@@ -4,6 +4,10 @@
|
||||
<span style="color: #fff;font-size: 26px;" ng-model="dashboardVersion">Sentinel 控制台 {{dashboardVersion}}</span>
|
||||
</div>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="https://www.aliyun.com/product/aliware/mse?spm=sentinel-dashboard.topbar.0.0.0" target="_blank"
|
||||
style="margin: 3px 15px 0 0;"><span class="glyphicon glyphicon-cloud"></span> Sentinel 企业版</a>
|
||||
</li>
|
||||
<li ng-show="showLogout">
|
||||
<a href="javascript:void(0);" ng-click="logout()"
|
||||
style="margin: 3px 15px 0 0;"><span class="glyphicon glyphicon-log-out"></span> 注销</a>
|
||||
|
Reference in New Issue
Block a user