mirror of
https://gitee.com/huoyo/ko-time.git
synced 2025-12-06 16:58:26 +08:00
fix 'no value present'
This commit is contained in:
parent
86e2c9afb2
commit
da4d5f59ac
18
README.md
18
README.md
@ -26,15 +26,15 @@ http://huoyo.gitee.io/ko-time/
|
||||
<dependency>
|
||||
<groupId>cn.langpy</groupId>
|
||||
<artifactId>ko-time</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
```
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-${freemarker或者thymeleaf任选一个}</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-${freemarker或者thymeleaf任选一个}</artifactId>
|
||||
</dependency>
|
||||
```
|
||||
2. 配置信息
|
||||
|
||||
@ -44,10 +44,12 @@ spring.profiles.active=koTime
|
||||
koTime.log.enable=false # 是否开启控制输出,非必填,默认false
|
||||
koTime.log.language=chinese # 控制台输出语言(english/chinese)非必填,默认chinese
|
||||
koTime.time.threshold=800.0 # 时间阈值,用于前端展示,大于阈值显示红色,小于阈值显示绿色,非必填,默认800
|
||||
koTime.pointcut=execution(* com.huoyo..*.*(..)) 需要监测的切面范围,参考aop的@pointcut v1.4开始加入的功能,用来替代下面的步骤3
|
||||
koTime.pointcut=execution(* com.huoyo.demo.controller.*(..)) || execution(* com.huoyo.demo.service.*(..)) 需要监测的切面范围(比如监测controller层和service层),参考aop的@pointcut v1.4开始加入的功能,用来替代下面的步骤3
|
||||
koTime.ui.template=thymeleaf 前端页面模板,默认为freemarker,可选thymeleaf 与引入的pom依赖对应
|
||||
```
|
||||
|
||||
`注意:暂不支持mybatis的mapper监测`
|
||||
|
||||
|
||||
3. 新建一个类,实现ComputeTimeHandlerInterface,并在 @Pointcut 写入 需要监测的范围
|
||||
|
||||
@ -118,6 +120,8 @@ public class RunTimeHandler implements ComputeTimeHandlerInterface {
|
||||
|
||||
> V1.6:兼容thymeleaf
|
||||
|
||||
> V1.7:修复未调用接口时No value present异常
|
||||
|
||||
#### 特别说明
|
||||
|
||||
1.本项目使用java8开发,其他版本未曾试验,如有什么bug还请告知!
|
||||
@ -132,4 +136,6 @@ public class RunTimeHandler implements ComputeTimeHandlerInterface {
|
||||
</dependency>
|
||||
```
|
||||
|
||||
3.项目使用@Aspect注解,未引入 aop相关包的自行引入,如aspectj或者spring-boot-starter-aop
|
||||
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.langpy</groupId>
|
||||
<artifactId>ko-time</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
<name>koTime</name>
|
||||
<description>koTime</description>
|
||||
<licenses>
|
||||
|
||||
@ -6,9 +6,9 @@ public class SystemStatistic {
|
||||
private Double avgRunTime = 0.0;
|
||||
private Double maxRunTime = 0.0;
|
||||
private Double minRunTime = 0.0;
|
||||
private Integer totalNum;
|
||||
private Integer delayNum;
|
||||
private Integer normalNum;
|
||||
private Integer totalNum = 0 ;
|
||||
private Integer delayNum = 0;
|
||||
private Integer normalNum = 0;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
@ -66,8 +66,11 @@ public class RunTimeNodeService {
|
||||
}
|
||||
|
||||
public static SystemStatistic getRunStatistic() {
|
||||
List<RunTimeNode> controllerApis = GraphMap.get(MethodType.Controller);
|
||||
SystemStatistic systemStatistic = new SystemStatistic();
|
||||
List<RunTimeNode> controllerApis = GraphMap.get(MethodType.Controller);
|
||||
if (null==controllerApis || controllerApis.size()==0 ) {
|
||||
return systemStatistic;
|
||||
}
|
||||
int delayNum = (int)controllerApis.stream().filter(controllerApi -> controllerApi.getAvgRunTime() >= Context.getConfig().getTimeThreshold()).count();
|
||||
systemStatistic.setDelayNum(delayNum);
|
||||
int normalNum = (int)controllerApis.stream().filter(controllerApi -> controllerApi.getAvgRunTime() < Context.getConfig().getTimeThreshold()).count();
|
||||
|
||||
@ -60,6 +60,9 @@
|
||||
<div class="code">最小响应(ms)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<blockquote class="layui-elem-quote">接口根据调用情况统计,未调用的接口无法被统计到,请先调用接口</blockquote>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab-item">
|
||||
@ -127,7 +130,7 @@
|
||||
echarts.util.each(data.children, function (datum, index) {
|
||||
index % 2 === 0 && (datum.collapsed = true);
|
||||
});
|
||||
myChart.setOption(option = getOption(data));
|
||||
myChart.setOption(option = getOption(data,threshold));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,9 @@
|
||||
<div class="code">最小响应(ms)</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<blockquote class="layui-elem-quote">接口根据调用情况统计,未调用的接口无法被统计到,请先调用接口</blockquote>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab-item">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user