Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
5ebb8e4d
Commit
5ebb8e4d
authored
Nov 27, 2020
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: log
parent
e66554a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
index.js
src/pages/log/omsLog/index.js
+7
-1
index.js
src/pages/log/serviceLog/index.js
+56
-3
No files found.
src/pages/log/omsLog/index.js
View file @
5ebb8e4d
...
...
@@ -65,9 +65,15 @@ const ServiceLog = () => {
key
:
'Body'
,
},
{
title
:
'
状态码
'
,
title
:
'
结果
'
,
dataIndex
:
'Result'
,
key
:
'Result'
,
render
:
record
=>
{
if
(
record
===
0
)
{
return
'正常'
;
}
return
'错误'
;
},
},
{
title
:
'错误信息'
,
...
...
src/pages/log/serviceLog/index.js
View file @
5ebb8e4d
...
...
@@ -23,6 +23,7 @@ const ServiceLog = () => {
const
[
data0
,
setData0
]
=
useState
([]);
// 源数据
const
[
pathCount
,
setPathCount
]
=
useState
([]);
// 接口调用次数,统计数据
const
[
reponseTime
,
setReponseTime
]
=
useState
([]);
// 接口调用时长,统计数据
const
[
perMinute
,
setPerMinute
]
=
useState
([]);
// 每分钟访问量,统计数据
const
[
scale
,
setScale
]
=
useState
({});
// 坐标轴别名
const
[
startTime
,
setStartTime
]
=
useState
(
moment
().
startOf
(
'day'
));
// 默认值当天0点
const
[
endTime
,
setEndTime
]
=
useState
(
...
...
@@ -65,9 +66,15 @@ const ServiceLog = () => {
key
:
'Body'
,
},
{
title
:
'
状态码
'
,
title
:
'
结果
'
,
dataIndex
:
'Result'
,
key
:
'Result'
,
render
:
record
=>
{
if
(
record
===
0
)
{
return
'正常'
;
}
return
'错误'
;
},
},
{
title
:
'错误信息'
,
...
...
@@ -133,7 +140,15 @@ const ServiceLog = () => {
item
.
key
=
index
;
return
item
;
});
const
dataPerHour
=
data
.
map
((
item
,
index
)
=>
({
key
:
index
,
minute
:
item
.
CallTime
.
slice
(
0
,
16
),
// 每分钟minute
hour
:
item
.
CallTime
.
slice
(
0
,
13
),
// 每分钟minute
date
:
item
.
CallTime
.
slice
(
0
,
10
),
// 每分钟minute
}));
console
.
log
(
dataPerHour
);
// 设置坐标轴别名
const
scale1
=
{
Path
:
{
alias
:
'接口名称'
,
// 别名
...
...
@@ -141,9 +156,26 @@ const ServiceLog = () => {
响应时长
:
{
alias
:
'响应时长/ms'
,
// 别名
},
minute
:
{
alias
:
'每分钟访问量'
,
},
hour
:
{
alias
:
'每小时访问量'
,
},
};
setScale
(
scale1
);
const
dv
=
new
DataSet
.
View
().
source
(
dataPerHour
);
dv
.
transform
({
type
:
'aggregate'
,
// 别名summary
fields
:
[
'minute'
],
// 统计字段集
operations
:
[
'count'
],
// 统计操作集
as
:
[
'计数'
],
// 存储字段集
groupBy
:
[
'minute'
],
// 分组字段集
});
console
.
log
(
dv
.
rows
);
setPerMinute
(
dv
.
rows
);
const
dv1
=
new
DataSet
.
View
().
source
(
data
);
dv1
.
transform
({
...
...
@@ -240,7 +272,28 @@ const ServiceLog = () => {
<
/Row
>
<
Spin
spinning
=
{
loading
}
tip
=
"loading"
>
<
Row
className
=
{
styles
.
chart
}
>
<
Col
span
=
{
12
}
>
<
Col
span
=
{
8
}
>
<
Chart
height
=
{
300
}
width
=
{
400
}
autoFit
data
=
{
perMinute
}
interactions
=
{[
'active-region'
]}
padding
=
"auto"
scale
=
{
scale
}
>
<
Axis
name
=
"minute"
// label={{ autoEllipsis: 'true', autoHide: 'true' }}
label
=
"null"
title
=
{{
offset
:
20
}}
/
>
{
/* <Axis name="计数" title /> */
}
<
Interval
position
=
"minute*计数"
/>
<
Tooltip
shared
/>
<
/Chart
>
<
/Col
>
<
Col
span
=
{
8
}
>
<
Chart
height
=
{
300
}
width
=
{
400
}
...
...
@@ -261,7 +314,7 @@ const ServiceLog = () => {
<
Tooltip
shared
/>
<
/Chart
>
<
/Col
>
<
Col
span
=
{
12
}
>
<
Col
span
=
{
8
}
>
<
Chart
height
=
{
300
}
width
=
{
400
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment