Sentinel
Sentinel copied to clipboard
docker 导致无法正常监控
Issue Description
控制台,无法正常监控,机器列表里面显示健康状态正常,但是没有监控数据。
Describe what happened (or what feature you want)
客服端我采用docker部署,导致客服端向控制台发送心跳带的参数中,ip地址是docker的ip,也就导致了控制台无法正常拉取数据(docker已经暴露了相关端口)
Describe what you expected to happen
目前我是继承SimpleHttpHeartbeatSender类,添加自己的配置,代码如下:
public class MySimpleHttpHeartbeatSender extends SimpleHttpHeartbeatSender {
public MySimpleHttpHeartbeatSender() {
String ip = System.getProperty(BaseConstants.ip);
if (StringUtils.isNotBlank(ip)) {
try {
Field field = getClass().getSuperclass().getDeclaredField("heartBeat");
field.setAccessible(true);
HeartbeatMessage heartBeat = (HeartbeatMessage) field.get(this);
heartBeat.registerInformation("ip", ip);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
然后更改sentinel-transport-simple-http-1.3.0-GA.jar包/META-INF/services/com.alibaba.csp.sentinel.transport.HeartbeatSender文件内容为MySimpleHttpHeartbeatSender 这样导致以后升级都得改这个java包,非常麻烦,希望官方允许配置客服端ip。
How to reproduce it (as minimally and precisely as possible)
Tell us your environment
spring boot 2
Anything else we need to know?
Thanks for reporting. We'll try to find an approach to address it.
宿主机模式应该可以临时解决下问题吧. 或者容器都link在一起应该也可以解决?