Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dataquality_doc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王东
dataquality_doc
Commits
543678c1
Commit
543678c1
authored
Aug 16, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
6f44702e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
144 deletions
+108
-144
RZ_DM/RZ_DM_QUANTILE.sql
RZ_DM/RZ_DM_QUANTILE.sql
+47
-55
RZ_DM/RZ_DM_RUNSTATUS.sql
RZ_DM/RZ_DM_RUNSTATUS.sql
+47
-75
RZ_DM/元数据DDL/QUANTILE_AGENTID.sql
RZ_DM/元数据DDL/QUANTILE_AGENTID.sql
+3
-3
RZ_DM/元数据DDL/QUANTILE_APP.sql
RZ_DM/元数据DDL/QUANTILE_APP.sql
+2
-2
RZ_DM/元数据DDL/RUNSTATUS_AGENTID.sql
RZ_DM/元数据DDL/RUNSTATUS_AGENTID.sql
+3
-3
RZ_DM/元数据DDL/RUNSTATUS_APP.sql
RZ_DM/元数据DDL/RUNSTATUS_APP.sql
+2
-2
RZ_DM/元数据DDL/RUNSTATUS_URL.sql
RZ_DM/元数据DDL/RUNSTATUS_URL.sql
+4
-4
数据模型表定义.xlsx
数据模型表定义.xlsx
+0
-0
No files found.
RZ_DM/RZ_DM_QUANTILE.sql
View file @
543678c1
-- RZ_DM_QUANTILE ZB_DM_单位时间内访问时间排序
-- 视图
-- step1:
-- 接口汇总
CREATE
TEMPORARY
VIEW
VIEW_RZ_DM_QUANTILE
AS
select
d1
.
`applicationName`
as
`applicationname`
,
d1
.
`agentId`
as
`agentid`
,
cast
(
tumble_end
(
d1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`time`
,
CastToTagIndexUDF
(
LISTAGG
(
d1
.
`elapsed`
,
';'
)
)
as
`quantile`
-- 拼接
,
cast
(
tumble_start
(
d1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`createtime`
from
(
select
`applicationName`
,
`agentId`
,
`endPoint`
,
`rpc`
,
`startTime`
,
`endTime`
,
`elapsed`
,
`status`
,
`row_time`
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
)
d1
where
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
d1
.
status
=
'200'
and
RIGHT
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
RIGHT
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
RIGHT
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
RIGHT
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
group
by
d1
.
`applicationName`
,
d1
.
`agentId`
,
tumble
(
d1
.
row_time
,
interval
'1'
minute
)
;
-- QUANTILE_AGENTID 单位时间内访问时间排序按应用统计
insert
into
RZ_DM
.
RZ_DM_
MYSQL
.
QUANTILE_AGENTID
insert
into
RZ_DM
.
RZ_DM_
KAFKA
.
QUANTILE_AGENTID
SELECT
s1
.
`applicationname`
as
`applicationname`
,
s1
.
`agentid`
as
`agentid`
...
...
@@ -10,39 +51,13 @@ SELECT
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
1
)
as
`quantile75`
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
2
)
as
`quantile95`
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
3
)
as
`quantile99`
,
cast
(
DateTimeToLongUDF
()
as
varchar
)
as
`createtime`
from
(
select
c1
.
`applicationname`
as
`applicationname`
,
c1
.
`agentid`
as
`agentid`
,
c1
.
`time`
as
`time`
,
CastToTagIndexUDF
(
c1
.
`lists`
)
as
`quantile`
-- 自定义数组排序函数
from
(
select
d1
.
`applicationName`
as
`applicationname`
,
d1
.
`agentId`
as
`agentid`
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
as
`time`
,
LISTAGG
(
d1
.
`elapsed`
,
';'
)
as
`lists`
-- 拼接
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
d1
where
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
d1
.
status
=
'200'
and
RIGHT
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
RIGHT
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
RIGHT
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
RIGHT
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
group
by
d1
.
`applicationName`
,
d1
.
`agentId`
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
)
c1
)
s1
,
s1
.
`createtime`
as
`createtime`
from
VIEW_RZ_DM_QUANTILE
s1
;
-- QUANTILE_APP 单位时间内访问时间排序按集群统计
insert
into
RZ_DM
.
RZ_DM_
MYSQL
.
QUANTILE_APP
insert
into
RZ_DM
.
RZ_DM_
KAFKA
.
QUANTILE_APP
SELECT
s1
.
`applicationname`
as
`applicationname`
,
s1
.
`time`
as
`time`
...
...
@@ -50,31 +65,8 @@ SELECT
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
1
)
as
`quantile75`
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
2
)
as
`quantile95`
,
SPLIT_INDEX
(
s1
.
`quantile`
,
';'
,
3
)
as
`quantile99`
,
cast
(
DateTimeToLongUDF
()
as
varchar
)
as
`createtime`
from
(
select
c1
.
`applicationname`
as
`applicationname`
,
c1
.
`time`
as
`time`
,
CastToTagIndexUDF
(
c1
.
`lists`
)
as
`quantile`
from
(
select
d1
.
`applicationName`
as
`applicationname`
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
as
`time`
,
LISTAGG
(
d1
.
`elapsed`
,
';'
)
as
`lists`
-- 拼接
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
d1
where
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
d1
.
status
=
'200'
and
RIGHT
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
RIGHT
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
RIGHT
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
RIGHT
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
group
by
d1
.
`applicationName`
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
)
c1
)
s1
,
s1
.
`createtime`
as
`createtime`
from
VIEW_RZ_DM_QUANTILE
s1
;
...
...
RZ_DM/RZ_DM_RUNSTATUS.sql
View file @
543678c1
-- RZ_DM_RUNSTATUS RZ_DM_访问次数
-- 视图
-- step1:
-- 接口汇总
CREATE
TEMPORARY
VIEW
VIEW_RZ_DM_RUNSTATUS
AS
s1
.
applicationname
as
`applicationname`
,
s1
.
agentid
as
`agentid`
,
s1
.
endpoint
as
`endpoint`
,
s1
.
rpc
as
`rpc`
,
concat
(
LongTimeToStringUDF
(
cast
(
s1
.
endTime
as
bigint
)
*
60000
,
'yyyy-MM-dd HH:mm'
),
":00"
)
as
`time`
,
AVG
(
s1
.
elapsed
)
as
`averageelapsed`
,
sum
(
1
)
as
`total`
,
sum
(
if
(
s1
.
status
=
'200'
,
1
,
0
))
as
`suctotal`
,
sum
(
if
(
s1
.
status
=
'200'
is
not
true
,
1
,
0
))
as
`errortotal`
,
DateTimeToLongUDF
()
as
`createtime`
from
RZ_ODS
.
RZ_ODS_KAFKA_RZ
.
RZDATA
s1
where
LongTimeToStringUDF
(
s1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>
DATEFORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
3
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
group
by
s1
.
applicationname
,
s1
.
agentid
,
s1
.
endpoint
,
s1
.
rpc
,
concat
(
LongTimeToStringUDF
(
cast
(
s1
.
endTime
as
bigint
)
*
60000
,
'yyyy-MM-dd HH:mm'
),
":00"
)
;
-- RZ_DM_RUNSTATUS_URL RZ_DM_访问次数按地址统计
insert
into
RZ_DM
.
RZ_DM_MYSQL
.
RZDATARZ_DM_RUNSTATUS_URL
-- RUNSTATUS_URL RZ_DM_访问次数按地址统计
insert
into
RZ_DM
.
RZ_DM_KAFKA
.
RUNSTATUS_URL
select
s1
.
`applicationname`
,
s1
.
`agentid`
,
s1
.
`endpoint`
,
s1
.
`rpc`
,
s1
.
`time`
,
s1
.
`averageelapsed`
,
s1
.
`total`
,
s1
.
`suctotal`
,
s1
.
`errortotal`
,
s1
.
`createtime`
from
VIEW_RZ_DM_RUNSTATUS
s1
s1
.
applicationName
as
`applicationname`
,
s1
.
agentId
as
`agentid`
,
s1
.
endPoint
as
`endpoint`
,
s1
.
rpc
as
`rpc`
,
cast
(
tumble_end
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`time`
,
cast
(
AVG
(
cast
(
s1
.
elapsed
as
decimal
(
18
,
2
))
)
as
varchar
)
as
`averageelapsed`
,
cast
(
sum
(
1
)
as
varchar
)
as
`total`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
,
1
,
0
))
as
varchar
)
as
`suctotal`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
is
not
true
,
1
,
0
))
as
varchar
)
as
`errortotal`
,
cast
(
tumble_start
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`createtime`
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
s1
group
by
s1
.
applicationName
,
s1
.
agentId
,
s1
.
endPoint
,
s1
.
rpc
,
tumble
(
s1
.
row_time
,
interval
'1'
minute
)
;
-- R
Z_DM_R
UNSTATUS_AGENTID RZ_DM_访问次数按应用统计
insert
into
RZ_DM
.
RZ_DM_
MYSQL
.
RZ_DM_
RUNSTATUS_AGENTID
-- RUNSTATUS_AGENTID RZ_DM_访问次数按应用统计
insert
into
RZ_DM
.
RZ_DM_
KAFKA
.
RUNSTATUS_AGENTID
select
s1
.
`applicationname`
,
s1
.
`agentid`
,
s1
.
`time`
,
s1
.
`averageelapsed`
,
s1
.
`total`
,
s1
.
`suctotal`
,
s1
.
`errortotal`
,
s1
.
`createtime`
from
VIEW_RZ_DM_RUNSTATUS
s1
s1
.
applicationName
as
`applicationname`
,
s1
.
agentId
as
`agentid`
,
cast
(
tumble_end
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`time`
,
cast
(
AVG
(
cast
(
s1
.
elapsed
as
decimal
(
18
,
2
))
)
as
varchar
)
as
`averageelapsed`
,
cast
(
sum
(
1
)
as
varchar
)
as
`total`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
,
1
,
0
))
as
varchar
)
as
`suctotal`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
is
not
true
,
1
,
0
))
as
varchar
)
as
`errortotal`
,
cast
(
tumble_start
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`createtime`
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
s1
group
by
s1
.
`applicationname`
,
s1
.
`agentid`
,
s1
.
`time`
,
s1
.
`averageelapsed`
,
s1
.
`total`
,
s1
.
`suctotal`
,
s1
.
`errortotal`
,
s1
.
`createtime`
s1
.
applicationName
,
s1
.
agentId
,
tumble
(
s1
.
row_time
,
interval
'1'
minute
)
;
-- R
Z_DM_R
UNSTATUS_APP RZ_DM_访问次数按集群统计
insert
into
RZ_DM
.
RZ_DM_
MYSQL
.
RZ_DM_
RUNSTATUS_APP
-- RUNSTATUS_APP RZ_DM_访问次数按集群统计
insert
into
RZ_DM
.
RZ_DM_
KAFKA
.
RUNSTATUS_APP
select
s1
.
`applicationname`
,
s1
.
`time`
,
s1
.
`averageelapsed`
,
s1
.
`total`
,
s1
.
`suctotal`
,
s1
.
`errortotal`
,
s1
.
`createtime`
from
VIEW_RZ_DM_RUNSTATUS
s1
group
by
s1
.
`applicationname`
,
s1
.
`time`
,
s1
.
`averageelapsed`
,
s1
.
`total`
,
s1
.
`suctotal`
,
s1
.
`errortotal`
,
s1
.
`createtime`
s1
.
applicationName
as
`applicationname`
,
cast
(
tumble_end
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`time`
,
cast
(
AVG
(
cast
(
s1
.
elapsed
as
decimal
(
18
,
2
))
)
as
varchar
)
as
`averageelapsed`
,
cast
(
sum
(
1
)
as
varchar
)
as
`total`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
,
1
,
0
))
as
varchar
)
as
`suctotal`
,
cast
(
sum
(
if
(
s1
.
status
=
'200'
is
not
true
,
1
,
0
))
as
varchar
)
as
`errortotal`
,
cast
(
tumble_start
(
s1
.
row_time
,
interval
'1'
minute
)
as
varchar
)
as
`createtime`
from
RZ_ODS
.
RZ_ODS_KAFKA
.
RZDATA
s1
group
by
s1
.
applicationName
,
tumble
(
s1
.
row_time
,
interval
'1'
minute
)
;
RZ_DM/元数据DDL/QUANTILE_AGENTID.sql
View file @
543678c1
-- QUANTILE_AGENTID 单位时间内访问时间排序按应用统计
create
table
QUANTILE_AGENTID
(
`applicationname`
String
primary
,
-- 部署集群 tag
`agentid`
String
primary
,
-- 应用系统
`time`
String
primary
,
-- 接口访问结束时间 主键 来源为源数据
`applicationname`
String
,
-- 部署集群 tag
`agentid`
String
,
-- 应用系统
`time`
String
,
-- 接口访问结束时间 主键 来源为源数据
`quantile50`
String
,
-- 分位值50
`quantile75`
String
,
-- 分位值75
`quantile95`
String
,
-- 分位值95
...
...
RZ_DM/元数据DDL/QUANTILE_APP.sql
View file @
543678c1
-- QUANTILE_APP 单位时间内访问时间排序按集群统计
create
table
QUANTILE_APP
(
`applicationname`
String
primary
,
-- 部署集群 tag
`time`
String
primary
,
-- 接口访问结束时间 主键 来源为源数据
`applicationname`
String
,
-- 部署集群 tag
`time`
String
,
-- 接口访问结束时间 主键 来源为源数据
`quantile50`
String
,
-- 分位值50
`quantile75`
String
,
-- 分位值75
`quantile95`
String
,
-- 分位值95
...
...
RZ_DM/元数据DDL/RUNSTATUS_AGENTID.sql
View file @
543678c1
...
...
@@ -2,9 +2,9 @@
create
table
RUNSTATUS_AGENTID
(
`applicationname`
String
primary
,
-- 部署集群
`agentid`
String
primary
,
-- 应用系统
`time`
String
primary
,
-- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`applicationname`
String
,
-- 部署集群
`agentid`
String
,
-- 应用系统
`time`
String
,
-- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed`
String
,
-- 接口平均响应时间
`total`
String
,
-- 接口访问总计
`suctotal`
String
,
-- 访问成功统计
...
...
RZ_DM/元数据DDL/RUNSTATUS_APP.sql
View file @
543678c1
...
...
@@ -2,8 +2,8 @@
create
table
RUNSTATUS_APP
(
`applicationname`
String
primary
,
-- 部署集群
`time`
String
primary
,
-- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`applicationname`
String
,
-- 部署集群
`time`
String
,
-- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed`
String
,
-- 接口平均响应时间
`total`
String
,
-- 接口访问总计
`suctotal`
String
,
-- 访问成功统计
...
...
RZ_DM/元数据DDL/RUNSTATUS_URL.sql
View file @
543678c1
-- RUNSTATUS_URL 访问次数按地址统计
create
table
RUNSTATUS_URL
(
applicationname
String
primary
,
-- 部署集群
agentid
String
primary
,
-- 应用系统
endpoint
String
primary
,
-- 服务地址
rpc
String
primary
,
-- 接口地址
applicationname
String
,
-- 部署集群
agentid
String
,
-- 应用系统
endpoint
String
,
-- 服务地址
rpc
String
,
-- 接口地址
time
String
,
-- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
averageelapsed
String
,
-- 接口平均响应时间
total
String
,
-- 接口访问总计
...
...
数据模型表定义.xlsx
View file @
543678c1
No preview for this file type
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