-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Fix the problem that dashboard do not correctly show the SystemRule in CPU usage strategy #922
Conversation
Crazy10552 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Hi, thanks for contributing. Could you please sign the CLA here? And please make sure the email of your commits match your GitHub email. 感谢贡献,请将 commit 对应的 email 调整成与 GitHub 的 email 相匹配并 确认一下 CLA。 |
@@ -33,6 +33,7 @@ | |||
private Long avgRt; | |||
private Long maxThread; | |||
private Double qps; | |||
private Double avgCpu; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to be maxCpuUsage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw properties in SystemRule named highestSystemLoad and it named avgLoad in SystemRuleEntity ,so i just do like to name highestCpuUsage in SystemRule to avgCpu in SystemRuleEntity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other legacy fields might not be good enough... For CPU usage it's an instantaneous value rather than average value.
@@ -119,6 +121,9 @@ app.controller('SystemCtl', ['$scope', '$stateParams', 'SystemService', 'ngDialo | |||
} else if (rule.qps != -1) { | |||
ruleTypeDesc = 'QPS'; | |||
ruleTypeCount = rule.qps; | |||
}else if (rule.avgCpu != -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto (maxCpuUsage
)
@@ -49,12 +49,14 @@ | |||
<span ng-if="rule.avgRt >= 0">RT</span> | |||
<span ng-if="rule.maxThread >= 0">线程数</span> | |||
<span ng-if="rule.qps >= 0">QPS</span> | |||
<span ng-if="rule.avgCpu >= 0">CPU</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
叫 CPU 使用率
可能更合适些?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know it's much better but i just confused by the AvgLoad ,i can fix both two of them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's indeed confusing. You could fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…(原avgLoad) 属性名称错误的命名
if (avgLoad != null) { | ||
if (avgLoad < 0) { | ||
return Result.ofFail(-1, "avgLoad must >= 0"); | ||
if (highestSystemLoad != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
highestSystemLoad
的取值范围是 [0, +∞),load 没有 < 1 的限制。这个需要保持与之前一致。
Codecov Report
@@ Coverage Diff @@
## master #922 +/- ##
============================================
+ Coverage 42.54% 42.55% +0.01%
- Complexity 1441 1442 +1
============================================
Files 310 310
Lines 8993 8993
Branches 1222 1222
============================================
+ Hits 3826 3827 +1
Misses 4698 4698
+ Partials 469 468 -1
Continue to review full report at Codecov.
|
<!--avgLoad --> | ||
<input type="radio" name="grade" value="0" ng-model='currentRule.grade' ng-disabled="systemRuleDialog.type == 'edit'" /> LOAD | ||
<!--highestSystemLoad --> | ||
<input type="radio" name="grade" value="0" ng-model='currentRule.grade' ng-disabled="systemRuleDialog.type == 'edit'" /> 最大系统LOAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是阈值,不需要强调”最大“,这里直接叫 Load 即可
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see
/> | ||
<input type='number' class="form-control highlight-border" ng-model='currentRule.qps' placeholder="[0, ~)的小数" ng-if="currentRule.grade == 3" | ||
/> | ||
<input type='number' class="form-control highlight-border" ng-model='currentRule.highestSystemLoad' placeholder="[0, 1)的小数" ng-if="currentRule.grade == 0"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load 的取值保持与之前一致
@@ -45,16 +45,18 @@ | |||
<tr dir-paginate="rule in rules | filter : searchKey | itemsPerPage: rulesPageConfig.pageSize " current-page="rulesPageConfig.currentPageIndex" | |||
pagination-id="entriesPagination"> | |||
<td style="word-wrap:break-word;word-break:break-all;"> | |||
<span ng-if="rule.avgLoad >= 0">LOAD</span> | |||
<span ng-if="rule.highestSystemLoad >= 0">最大系统LOAD</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
<span ng-if="rule.avgRt >= 0">RT</span> | ||
<span ng-if="rule.maxThread >= 0">线程数</span> | ||
<span ng-if="rule.qps >= 0">QPS</span> | ||
<span ng-if="rule.highestCpuUsage >= 0">最大CPU使用率</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
/> 入口 QPS | ||
<input type="radio" name="grade" value="3" ng-model='currentRule.grade' ng-disabled="systemRuleDialog.type == 'edit'"/> 入口 QPS | ||
<!--highestCpuUsage --> | ||
<input type="radio" name="grade" value="4" checked ng-model='currentRule.grade' ng-disabled="systemRuleDialog.type == 'edit'" /> 最大CPU使用 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPU 使用率
另外需要将 commit 对应的 email 调整成与 GitHub 的 email 相匹配并 确认一下 CLA 。可以参考:https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user |
…oard-issues-905 # Conflicts: # sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/system.js # sentinel-dashboard/src/main/webapp/resources/app/views/dialog/system-rule-dialog.html # sentinel-dashboard/src/main/webapp/resources/app/views/system.html
it fix the bug that dashboard do not correctly show the system rule(the rule about properties highestCpuUsage)
Does this pull request fix one issue?
Fixes #905
Describe how you did it
I add new properties in entity [com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity]
I update the related js and html about System rule
Describe how to verify it
Special notes for reviews
None