Closed Alice52 closed 4 years ago
[x] spring monitor no data
[x] restart monior data will loss: it is ok.
@lianshun1000
执行时间分布【】 这8个从左到右依次是:
执行+RS时分布
spring monitor no data
druid:
spring:
monitor:
enable: true
locations: cn.edu.ntu.seckill.repository.*
/**
* @create 2020-08-13 20:03 <br>
* @project project-seckill <br>
*/
@ConditionalOnProperty(
prefix = "druid.spring.monitor",
value = {"enable"},
havingValue = "true")
@Configuration
public class DruidConfiguration {
@Value("#{'${druid.spring.monitor.locations:}'.split(',')}")
private List<String> patterns;
@Bean
public DruidStatInterceptor druidStatInterceptor() {
return new DruidStatInterceptor();
}
@Bean
@Scope("prototype")
public JdkRegexpMethodPointcut druidStatPointcut() {
JdkRegexpMethodPointcut pointcut = new JdkRegexpMethodPointcut();
Optional.ofNullable(patterns)
.ifPresent(
x ->
pointcut.setPatterns(
ArrayUtil.toArray(
x.stream().map(String::trim).collect(Collectors.toList()), String.class)));
return pointcut;
}
@Bean
public DefaultPointcutAdvisor druidStatAdvisor(
DruidStatInterceptor druidStatInterceptor, JdkRegexpMethodPointcut druidStatPointcut) {
return new DefaultPointcutAdvisor(druidStatPointcut, druidStatInterceptor);
}
}
use druid integration with spring boot
use druid starter integration with spring boot
configuration
class