持久化热点规则出现的问题:objectMapper不能将规则json转换成ParamFlowRule
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Type: *bug report*
新增一个热点规则时,传来的json数据不能转换成com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule
收到的json(即图中的ruleStr):
```
{"app":"sentinel","gmtModified":1598930162707,"port":8723,"ip":"192.168.0.190","rule":{"burstCount":0,"clusterConfig":{"fallbackToLocalWhenFail":true,"sampleCount":10,"thresholdType":0,"windowIntervalMs":1000},"clusterMode":false,"controlBehavior":0,"count":1.0,"durationInSec":1,"grade":1,"limitApp":"default","maxQueueingTimeMs":0,"paramFlowItemList":[],"paramIdx":0,"resource":"a"},"id":18,"gmtCreate":1598930162707}
```

readValue执行后得到的Object:

控制台是模仿源码中的nacos流控规则改造的
publisher:

controller

个人觉得原因是ParamFlowRule 和 ParamFlowRuleEntity 结构不一致导致的。希望可以得到解决的方法
Contributor guide
Research direction
Start with the publisher and controller entry points shown in the report, then inspect the ObjectMapper readValue call and compare ParamFlowRule with ParamFlowRuleEntity. Use the provided rule JSON to reproduce the conversion failure and trace the Nacos flow-rule implementation for comparison. Done means the hotspot rule JSON converts to the expected ParamFlowRule structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100