mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
upgrade sentinel version to 1.7.2
This commit is contained in:
@@ -102,6 +102,20 @@ public class SentinelProperties {
|
||||
*/
|
||||
private Boolean httpMethodSpecify = false;
|
||||
|
||||
/**
|
||||
* Specify whether unify web context(i.e. use the default context name), and is true
|
||||
* by default.
|
||||
*/
|
||||
private Boolean webContextUnify = true;
|
||||
|
||||
public Boolean getWebContextUnify() {
|
||||
return webContextUnify;
|
||||
}
|
||||
|
||||
public void setWebContextUnify(Boolean webContextUnify) {
|
||||
this.webContextUnify = webContextUnify;
|
||||
}
|
||||
|
||||
public boolean isEager() {
|
||||
return eager;
|
||||
}
|
||||
|
@@ -96,6 +96,7 @@ public class SentinelWebAutoConfiguration implements WebMvcConfigurer {
|
||||
public SentinelWebMvcConfig sentinelWebMvcConfig() {
|
||||
SentinelWebMvcConfig sentinelWebMvcConfig = new SentinelWebMvcConfig();
|
||||
sentinelWebMvcConfig.setHttpMethodSpecify(properties.getHttpMethodSpecify());
|
||||
sentinelWebMvcConfig.setWebContextUnify(properties.getWebContextUnify());
|
||||
|
||||
if (blockExceptionHandlerOptional.isPresent()) {
|
||||
blockExceptionHandlerOptional
|
||||
|
@@ -61,7 +61,7 @@ public class SentinelEndpoint {
|
||||
result.put("metricsFileSize", SentinelConfig.singleMetricFileSize());
|
||||
result.put("metricsFileCharset", SentinelConfig.charset());
|
||||
result.put("totalMetricsFileCount", SentinelConfig.totalMetricFileCount());
|
||||
result.put("consoleServer", TransportConfig.getConsoleServer());
|
||||
result.put("consoleServer", TransportConfig.getConsoleServerList());
|
||||
result.put("clientIp", TransportConfig.getHeartbeatClientIp());
|
||||
result.put("heartbeatIntervalMs", TransportConfig.getHeartbeatIntervalMs());
|
||||
result.put("clientPort", TransportConfig.getPort());
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.alibaba.cloud.sentinel.endpoint;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.cloud.sentinel.SentinelProperties;
|
||||
@@ -24,13 +25,14 @@ import com.alibaba.csp.sentinel.datasource.AbstractDataSource;
|
||||
import com.alibaba.csp.sentinel.heartbeat.HeartbeatSenderProvider;
|
||||
import com.alibaba.csp.sentinel.transport.HeartbeatSender;
|
||||
import com.alibaba.csp.sentinel.transport.config.TransportConfig;
|
||||
import com.alibaba.csp.sentinel.util.function.Tuple2;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Status;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* A {@link HealthIndicator} for Sentinel, which checks the status of Sentinel Dashboard
|
||||
@@ -82,8 +84,9 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
// Check health of Dashboard
|
||||
boolean dashboardUp = true;
|
||||
String consoleServer = TransportConfig.getConsoleServer();
|
||||
if (StringUtils.isEmpty(consoleServer)) {
|
||||
List<Tuple2<String, Integer>> consoleServerList = TransportConfig
|
||||
.getConsoleServerList();
|
||||
if (CollectionUtils.isEmpty(consoleServerList)) {
|
||||
// If Dashboard isn't configured, it's OK and mark the status of Dashboard
|
||||
// with UNKNOWN.
|
||||
detailMap.put("dashboard",
|
||||
@@ -101,8 +104,10 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator {
|
||||
else {
|
||||
// If failed to send heartbeat message, means that the Dashboard is DOWN
|
||||
dashboardUp = false;
|
||||
detailMap.put("dashboard", new Status(Status.DOWN.getCode(),
|
||||
consoleServer + " can't be connected"));
|
||||
detailMap.put("dashboard",
|
||||
new Status(Status.DOWN.getCode(), String.format(
|
||||
"the dashboard servers [%s] one of them can't be connected",
|
||||
consoleServerList)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,12 @@
|
||||
"defaultValue": false,
|
||||
"description": "earlier initialize heart-beat when the spring container starts when the transport dependency is on classpath, the configuration is effective."
|
||||
},
|
||||
{
|
||||
"name": "spring.cloud.sentinel.web-context-unify",
|
||||
"type": "java.lang.Boolean",
|
||||
"defaultValue": true,
|
||||
"description": "Specify whether unify web context(i.e. use the default context name), and is true by default."
|
||||
},
|
||||
{
|
||||
"name": "spring.cloud.sentinel.transport.port",
|
||||
"type": "java.lang.String",
|
||||
|
Reference in New Issue
Block a user