alibaba / sentinel-golang

Sentinel Go enables reliability and resiliency for Go microservices
https://sentinelguard.io/
Apache License 2.0
2.77k stars 436 forks source link

fix getProcessCpuStat return value (in percentage) breaks compatibility. #540

Open sunyucheng opened 1 year ago

sunyucheng commented 1 year ago

Describe what this PR does / why we need it

fix getProcessCpuStat return value (in percentage) breaks compatibility.

Does this pull request fix one issue?

Fix https://github.com/alibaba/sentinel-golang/issues/539

Describe how you did it

fix the bug that the CPU usage from getProcessCpuStat was changed to percentage value (i.e. 0-100), which breaks compatibility and affects system adaptive rules.

Describe how to verify it

Added a unit test func TestRetrieveAndUpdateCpuStatReturnValueRange(t *testing.T)

Special notes for reviews

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.08 :tada:

Comparison is base (0807185) 53.17% compared to head (5d210df) 53.25%.

:exclamation: Current head 5d210df differs from pull request most recent head 0e75426. Consider uploading reports for the commit 0e75426 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #540 +/- ## ========================================== + Coverage 53.17% 53.25% +0.08% ========================================== Files 91 91 Lines 5894 5896 +2 ========================================== + Hits 3134 3140 +6 + Misses 2413 2408 -5 - Partials 347 348 +1 ``` | [Impacted Files](https://app.codecov.io/gh/alibaba/sentinel-golang/pull/540?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alibaba) | Coverage Δ | | |---|---|---| | [core/system\_metric/sys\_metric\_stat.go](https://app.codecov.io/gh/alibaba/sentinel-golang/pull/540?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alibaba#diff-Y29yZS9zeXN0ZW1fbWV0cmljL3N5c19tZXRyaWNfc3RhdC5nbw==) | `21.80% <100.00%> (+4.24%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

HelloCarry commented 1 year ago

Hi @binbin0325 @sczyh30, looking forward to your reply.

HelloCarry commented 1 year ago

Hi @sczyh30 @binbin0325, if there are no doubts, we look forward to the adoption of PR

HelloCarry commented 1 year ago

Hi @sczyh30 @binbin0325, looking forward to your reply

HelloCarry commented 1 year ago

Hi @sczyh30 @binbin0325, looking forward to your reply