1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

add property key spring.cloud.sentinel.transport.clientIp to configure client ip to connect with sentinel dashboard

This commit is contained in:
fangjian0423 2019-01-11 14:54:23 +08:00
parent 8979690e38
commit 3cf57afe32
3 changed files with 19 additions and 0 deletions

View File

@ -262,6 +262,8 @@ public class SentinelProperties {
*/
private String heartbeatIntervalMs;
private String clientIp;
public String getHeartbeatIntervalMs() {
return heartbeatIntervalMs;
}
@ -286,6 +288,13 @@ public class SentinelProperties {
this.dashboard = dashboard;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
}
public static class Filter {

View File

@ -96,6 +96,11 @@ public class SentinelAutoConfiguration {
System.setProperty(TransportConfig.HEARTBEAT_INTERVAL_MS,
properties.getTransport().getHeartbeatIntervalMs());
}
if (StringUtils.isEmpty(System.getProperty(TransportConfig.HEARTBEAT_CLIENT_IP))
&& StringUtils.hasText(properties.getTransport().getClientIp())) {
System.setProperty(TransportConfig.HEARTBEAT_CLIENT_IP,
properties.getTransport().getClientIp());
}
if (StringUtils.isEmpty(System.getProperty(SentinelConfig.CHARSET))
&& StringUtils.hasText(properties.getMetric().getCharset())) {
System.setProperty(SentinelConfig.CHARSET,

View File

@ -18,6 +18,11 @@
"defaultValue": "8719",
"description": "sentinel api port."
},
{
"name": "spring.cloud.sentinel.transport.clientIp",
"type": "java.lang.String",
"description": "sentinel client ip connect to dashboard."
},
{
"name": "spring.cloud.sentinel.transport.dashboard",
"type": "java.lang.String",