alibaba / sentinel-golang

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

[Question]Why change flow rule id to "string" #534

Open xiangtianyu opened 1 year ago

xiangtianyu commented 1 year ago

In golang sdk the flow rule id is changed from uint64 to string, but the java sdk is still "Long".

So when i tried to use nacos store the rule and shared it to both my java app and golang app, it will report

Fail to convert source bytes to []*flow.Rule, err: json: cannot unmarshal number into Go struct field Rule.id of type stringExiting

How can i handle this situation.

binbin0325 commented 1 year ago

need to investigate the use of id in java,is it necessary?

sczyh30 commented 1 year ago

Previous discussions: https://github.com/alibaba/Sentinel/pull/2853

binbin0325 commented 1 year ago

1: Maybe we can use the json.Number as the id type, compatible with older versions. 2: Implements logSlot to print logs

xiangtianyu commented 1 year ago

not only id, the flow block threshold count in java sdk names "count", but in golang, it names "threshold". These difference makes me difficult to do compatible between java and golang

binbin0325 commented 1 year ago

java and go will not be exactly the same,you can forget java and reconfigure according to golang