Browse Source

🎉 增加elk集成配置

test
smallchill 5 years ago
parent
commit
6197254ea2
  1. 32
      blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java
  2. 2
      blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java

32
blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java

@ -70,6 +70,21 @@ public interface CommonConstant {
*/
String ZIPKIN_TEST_ADDR = "http://172.30.0.58:9411";
/**
* elk dev 地址
*/
String ELK_DEV_ADDR = "127.0.0.1:9000";
/**
* elk prod 地址
*/
String ELK_PROD_ADDR = "172.30.0.58:9000";
/**
* elk test 地址
*/
String ELK_TEST_ADDR = "172.30.0.58:9000";
/**
* sword 系统名
*/
@ -156,4 +171,21 @@ public interface CommonConstant {
}
}
/**
* 动态获取elk地址
*
* @param profile 环境变量
* @return addr
*/
static String elkAddr(String profile) {
switch (profile) {
case (AppConstant.PROD_CODE):
return ELK_PROD_ADDR;
case (AppConstant.TEST_CODE):
return ELK_TEST_ADDR;
default:
return ELK_DEV_ADDR;
}
}
}

2
blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java

@ -39,6 +39,8 @@ public class LauncherServiceImpl implements LauncherService {
PropsUtil.setProperty(props, "spring.cloud.nacos.config.server-addr", CommonConstant.nacosAddr(profile));
PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", CommonConstant.sentinelAddr(profile));
PropsUtil.setProperty(props, "spring.zipkin.base-url", CommonConstant.zipkinAddr(profile));
// 开启elk日志
//PropsUtil.setProperty(props, "blade.log.elk.destination", CommonConstant.elkAddr(profile));
}
}

Loading…
Cancel
Save