update docs

This commit is contained in:
huoyo 2022-08-30 23:25:43 +08:00
parent 661ec7496e
commit 414cb95964
3 changed files with 69 additions and 22 deletions

View File

@ -7,7 +7,7 @@
<dependency>
<groupId>cn.langpy</groupId>
<artifactId>ko-time</artifactId>
<version>2.2.2</version>
<version>2.2.3-PRE</version>
</dependency>
```
@ -35,7 +35,7 @@ ko-time.auth-enable=true # 是否开启认证默认为false,开启后需要
ko-time.user-name=xxxx # 登录用户 v2.0.2开始支持
ko-time.password=xxxx # 登录密码 v2.0.2开始支持
ko-time.param-analyse=true # 是否开启入参组合分析 默认开启 v2.0.8开始支持 双击方法节点即可看到效果
ko-time.saver=memory # 接口信息存储位置,可选{memory,database} 默认memory v2.2.0-BETA
ko-time.saver=memory # 接口信息存储位置,可选{memory,database,redis} 默认memory v2.2.0-BETA
ko-time.thread-num=2 # 调用信息存储线程数为了不影响项目本身性能链路存储异步进行默认2该值并非越大越好瓶颈取决于数据库性能和服务器配置尽可能少占用项目资源为上 v2.2.0-BETA开始支持
```
@ -59,7 +59,8 @@ ko-time.thread-num=2 # 调用信息存储线程数(为了不影响项目本身
application.properties中定义了 `server.servlet.context-path=/myservice`,那么访问路径为`http://localhost:8080/myservice/koTime`
如果页面能正常显示,但是无法获取方法链路,可配置`ko-time.context-path=http://localhost:8080/myservice`
如果页面能正常显示但是无法获取方法链路可配置ko-time.context-path=http://正确路径/myservice进行koTime接口访问路径纠正
---

View File

@ -8,6 +8,50 @@ v2.2.0开始支持数据库存储接口信息功能,可在内存和数据库
> ko-time.saver=memory #默认存储方式,无需此配置也行
### Redis存储
1.更改配置:
> ko-time.saver=redis
>
> #redis配置
>
> spring.redis.host: xxx
>
> spring.redis.port: xxx
>
> spring.redis.password: xxx
>
2.引入依赖
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
```
3.其他
项目默认使用Springboot的StringRedisTemplate对象无需其他操作
如果对其不满意可以自定Bean如
```java
@Bean("redisbean")
public StringRedisTemplate getRedisTemplate(RedisConnectionFactory connectionFactory){
StringRedisTemplate template = new StringRedisTemplate();
template.setConnectionFactory(connectionFactory);
return template;
}
```
然后配置
> ko-time.redis-template: redisbean
### 数据库存储
> 注: 使用mysql
@ -16,26 +60,28 @@ v2.2.0开始支持数据库存储接口信息功能,可在内存和数据库
> ko-time.saver=database
> 请引入MySQL相关依赖
> 注:默认使用项目的数据源,多数据源情况下默认使用主数据源,如果没有主数据源,请在配置中指定数据源:`ko-time.data-source=数据源名称`
2.数据表创建
> 数据库字段长度不够的自行调整
```sql
create table ko_method_node (
id varchar(200) not null primary key comment '主键' ,
name varchar(200) null comment '类名+方法名' ,
class_name varchar(200) null comment '类名' ,
method_name varchar(200) null comment '方法名' ,
route_name varchar(200) null comment '路由controller才有' ,
id varchar(400) not null primary key comment '主键' ,
name varchar(400) null comment '类名+方法名' ,
class_name varchar(400) null comment '类名' ,
method_name varchar(400) null comment '方法名' ,
route_name varchar(400) null comment '路由controller才有' ,
method_type varchar(64) null comment '方法类型'
) comment '方法信息表';
create table ko_method_relation (
id varchar(200) not null primary key comment '' ,
source_id varchar(200) null comment '调用方id' ,
target_id varchar(200) null comment '被调用方id' ,
id varchar(400) not null primary key comment '' ,
source_id varchar(400) null comment '调用方id' ,
target_id varchar(400) null comment '被调用方id' ,
avg_run_time numeric(10,2) null comment '平均耗时' ,
max_run_time numeric(10,2) null comment '最大耗时' ,
min_run_time numeric(10,2) null comment '最小耗时'
@ -43,23 +89,23 @@ create table ko_method_relation (
;
create table ko_exception_node (
id varchar(200) not null primary key comment '主键' ,
name varchar(200) null comment '异常名' ,
class_name varchar(200) null comment '类名' ,
message varchar(200) null comment '异常消息'
id varchar(400) not null primary key comment '主键' ,
name varchar(400) null comment '异常名' ,
class_name varchar(400) null comment '类名' ,
message varchar(400) null comment '异常消息'
) comment '异常表';
create table ko_exception_relation (
id varchar(200) not null primary key comment '' ,
source_id varchar(200) null comment '调用方法id' ,
target_id varchar(200) null comment '异常id' ,
id varchar(400) not null primary key comment '' ,
source_id varchar(400) null comment '调用方法id' ,
target_id varchar(400) null comment '异常id' ,
location int null comment '异常位置'
) comment '异常关系表';
create table ko_param_ana (
source_id varchar(200) null comment '调用方法id' ,
params varchar(200) null comment '参数组合,-分隔' ,
source_id varchar(400) null comment '调用方法id' ,
params varchar(400) null comment '参数组合,-分隔' ,
avg_run_time numeric(10,2) null comment '平均耗时' ,
max_run_time numeric(10,2) null comment '最大耗时' ,
min_run_time numeric(10,2) null comment '最小耗时'

View File

@ -6,7 +6,7 @@
<groupId>cn.langpy</groupId>
<artifactId>ko-time</artifactId>
<version>2.2.3</version>
<version>2.2.3-PRE</version>
<name>KoTime</name>
<description>A springboot tool for tracking the paths of the methods,which can help you to find methods's performances easily.</description>
<licenses>