sunyucheng
sunyucheng
### 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 ###...
背景: 我在测试使用CPU作为阈值的系统自适应流控方案。 问题: 1、在 [func IsValidSystemRule(rule *Rule) error](https://github.com/alibaba/sentinel-golang/blob/08071855bc67423777353c6e02f1390b419172b1/core/system/rule_manager.go#L133C16-L133C16)中校验的 cpu取值范围为0.0~1.0。但是在实际测试中发现[func getProcessCpuStat() (float64, error)](https://github.com/alibaba/sentinel-golang/blob/08071855bc67423777353c6e02f1390b419172b1/core/system_metric/sys_metric_stat.go#L185C6-L185C23)函数的实际返回值大小为0.0~100.0。导致在注册规则时因阈值非法`invalid CPU usage, valid range is [0.0, 1.0]`而失败。 该处是否应该修改一下cpu的合法性校验范围。