Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add SQL audit result score #284

Closed
HuangWeiCen opened this issue Feb 10, 2022 · 3 comments
Closed

add SQL audit result score #284

HuangWeiCen opened this issue Feb 10, 2022 · 3 comments
Assignees
Labels
feature ui this issue is is related to the FE verified the issue all pr is verified
Milestone

Comments

@HuangWeiCen
Copy link
Contributor

HuangWeiCen commented Feb 10, 2022

原始需求

支持对SQL审核结果进行分类分级,并引入评分规则

目标实现

对SQL审核结果进行评分

实现方案

计分规则

  1. 分数为工单分数, 总分一百分, 总分向下取整
  2. 审核通过率: 30分 x 审核通过率
  3. Error以下级别的SQL出现率: 15分 x 出现率
  4. Warn以下级别的SQL出现率: 10分 x 出现率
  5. Notic以下级别的SQL出现率: 5分 x 出现率
  6. 没有Error(含)以上级别的SQL: 15分
  7. 没有Warn(含)以上级别的SQL: 10分
  8. 没有Notic(含)以上级别的SQL: 5分
  9. 级别在Error以下的SQL占比超90%: 5分
  10. 级别在Warn以下的SQL占比超90%: 3分
  11. 级别在Notic以下的SQL占比超90%: 2分

简易计分公式

  1. Error以上级别SQL出现率 = Error级别SQL数 / 总SQL数

  2. Warn以上级别SQL出现率 = (Error级别SQL数 + Warn级别SQL数) / 总SQL数

  3. Warn以上级别SQL出现率 = (Error级别SQL数 + Warn级别SQL数 + Notice级别SQL数) / 总SQL数

  4. 总分 = 审核通过率 x 30 +
    (1 - Error以上级别SQL出现率) x 15 +
    (1 - Warn以上级别SQL出现率) x 10 +
    (1 - Notice以上级别SQL出现率) x 5 +
    (Error以上级别SQL出现概率 == 0 ? 15 : 0) +
    (Warn以上级别SQL出现概率 == 0 ? 10 : 0) +
    (Notice以上级别SQL出现概率 == 0 ? 5 : 0) +
    (Error以上级别SQL出现概率 <0.1 ? 5 : 0) +
    (Warn以上级别SQL出现概率 <0.1? 3 : 0) +
    (Notice以上级别SQL出现概率 <0.1 ? 2 : 0)

备注: 三元表达式 ==> ( 条件 ? 如果条件为真则为此值 : 如果条件为假则为此值 )

实际案例

假设工单中共有13条SQL, 其中一条Error等级, 一条Warn等级, 两条Notice等级, 其他均为Nomal等级
实际得分为 :
总分 = 审核通过率 x 30 +
(1 - Error以上级别SQL出现率) x 15 +
(1 - Warn以上级别SQL出现率) x 10 +
(1 - Notice以上级别SQL出现率) x 5 +
(Error以上级别SQL出现概率 == 0 ? 15 : 0) +
(Warn以上级别SQL出现概率 == 0 ? 10 : 0) +
(Notice以上级别SQL出现概率 == 0 ? 5 : 0) +
(Error以上级别SQL出现概率 <0.1 ? 5 : 0) +
(Warn以上级别SQL出现概率 <0.1? 3 : 0) +
(Notice以上级别SQL出现概率 <0.1 ? 2 : 0)
= 0.6923 x 30 + (1 - 0.0769) x 15 + (1 - 0.1538) x 15 + (1 - 0.3076) x 15 + 0 + 0 + 0 + 0 + 0 + 5
≈ 45 (向下取整后的结果)

展示位置

image
image
获取方式同审核通过率

@sjjian sjjian added this to the v1.2201.1 milestone Feb 10, 2022
This was referenced Feb 11, 2022
@sjjian sjjian added feature ui this issue is is related to the FE labels Feb 14, 2022
@Rain-1214
Copy link
Member

还有工单被驳回时的修改SQL语句功能的 审核结果。也加了评分。

@HuangWeiCen
Copy link
Contributor Author

Development completed

@HuangWeiCen
Copy link
Contributor Author

改动后效果:
image
image
image

@Marcus9530 Marcus9530 added the verified the issue all pr is verified label Feb 25, 2022
taolx0 pushed a commit that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ui this issue is is related to the FE verified the issue all pr is verified
Projects
None yet
Development

No branches or pull requests

4 participants