10000 fix issue 3453: bridge ParamFlow and Authority rules to Nacos correctly (#3453) by yangsen0130 · Pull Request #3519 · alibaba/Sentinel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix issue 3453: bridge ParamFlow and Authority rules to Nacos correctly (#3453) #3519

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

Open
wants to merge 1 commit into
base: 1.8
Choose a base branch
from

Conversation

yangsen0130
Copy link

This pull request fixes issue #3453 by ensuring that ParamFlow and Authority rules published by Sentinel‑Dashboard to Nacos can be correctly parsed by Sentinel clients. In version 1.8.8 the dashboard’s entity classes and the core rule classes became out of sync, causing clients to fail to deserialize JSON and never load the rules.

What was changed:

  1. Introduced two “CorrectEntity” classes
    • ParamFlowRuleCorrectEntity
    • AuthorityRuleCorrectEntity
      These mirror the fields of the core ParamFlowRule and AuthorityRule types exactly.
  2. Registered new FastJSON Converter beans in NacosConfig for
    • String ↔ List<ParamFlowRuleCorrectEntity>
    • String ↔ List<AuthorityRuleCorrectEntity>
  3. Added dedicated Nacos provider & publisher components for both rule types:
    • ParamFlowRuleNacosProvider / ParamFlowRuleNacosPublisher
    • AuthorityRuleNacosProvider / AuthorityRuleNacosPublisher
      These bridge between the CorrectEntity JSON and the original Dashboard RuleEntity types via BeanUtils.copyProperties.

Describe what this PR does / why we need it

Sentinel‑Dashboard and Sentinel clients must share a consistent JSON schema when persisting rules in Nacos. After upgrading to 1.8.8, the Dashboard’s entity definitions drifted from the core rule classes, breaking client‑side deserialization. This PR restores compatibility so that rules published via Dashboard are correctly loaded by any Sentinel client.

Does this pull request fix one issue?

Fixes #3453

Describe how you did it

  • Added two “CorrectEntity” classes that exactly match the core rule classes’ fields.
  • Registered FastJSON converters in NacosConfig for the new entity lists.
  • Implemented provider & publisher beans that convert between Dashboard entities and core rule types at runtime.

Describe how to verify it

  1. Start Sentinel‑Dashboard (v1.8.8+) and connect it to a Nacos instance.
  2. Create / update ParamFlow and Authority rules via the Dashboard UI.
  3. On a Sentinel client, load rules from Nacos and assert that:
    • No JSON parsing errors occur.
    • The rules take effect as expected (e.g. QPS limits and authority checks).

Special notes for reviews

  • Backward compatibility is preserved: older clients (pre‑1.8.8) will still see the old JSON structure.
  • No changes to other rule types or transports.
  • All new classes and beans are isolated under the sentinel-dashboard Nacos extension.

Thank you for your time and feedback!

…orrectly (alibaba#3453)

This pull request fixes issue alibaba#3453 by ensuring that ParamFlow and Authority rules published by Sentinel‑Dashboard to Nacos can be correctly parsed by Sentinel clients. In version 1.8.8 the dashboard’s entity classes and the core rule classes became out of sync, causing clients to fail to deserialize JSON and never load the rules.

What was changed:
1. Introduced two “CorrectEntity” classes (ParamFlowRuleCorrectEntity and AuthorityRuleCorrectEntity) that exactly mirror the fields of the core ParamFlowRule and AuthorityRule types.
2. Registered new FastJSON Converter beans in NacosConfig for String↔List<ParamFlowRuleCorrectEntity> and String↔List<AuthorityRuleCorrectEntity>.
3. Added dedicated Nacos provider and publisher components for ParamFlow and Authority rules (ParamFlowRuleNacosProvider / ParamFlowRuleNacosPublisher and AuthorityRuleNacosProvider / AuthorityRuleNacosPublisher) that bridge between CorrectEntity JSON and the original Dashboard RuleEntity types via BeanUtils.copyProperties.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully mergin 3D0C g this pull request may close these issues.

[BUG] 关于热点参数不生效的讨论
3 participants
0