Skip to content
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

SentinelConverter不支持热点参数规则 #771

Closed
eacdy opened this issue Jul 21, 2019 · 6 comments
Closed

SentinelConverter不支持热点参数规则 #771

eacdy opened this issue Jul 21, 2019 · 6 comments
Labels
area/sentinel spring cloud alibaba sentinel kind/question

Comments

@eacdy
Copy link
Contributor

eacdy commented Jul 21, 2019

org.springframework.cloud.alibaba.sentinel.datasource.converter.SentinelConverter

不支持热点参数限流。

我写了个Sentinel Dashboard,使用Nacos持久化数据。安装包、使用说明在这里:https://github.com/eacdy/Sentinel-Dashboard-Nacos/releases

其他规则都能正常解析,唯独热点参数限流规则无法正常解析。感觉这是个BUG,请修正。

PS. SentinelConverter的代码两层try...catch...,代码可读性不佳,而且报的异常上去就ignore,里面什么都不打印,很不友好。我调试时,就是会进到ignore异常的。

是否应该改进下?

@fangjian0423 fangjian0423 added area/sentinel spring cloud alibaba sentinel good first issue labels Jul 22, 2019
@lltx
Copy link
Collaborator

lltx commented Jul 24, 2019

demo 中的热点规则,可以直接用

[
  {
    "resource": "aa",
    "count": 0,
    "grade": 1,
    "limitApp": "default",
    "paramIdx": 0,
    "paramFlowItemList": [
      {
        "object": "2",
        "classType": "int",
        "count": 1
      }
    ]
  }
]

@eacdy
Copy link
Contributor Author

eacdy commented Jul 24, 2019

@pigxcloud 我的热点规则如下,无法使用。

[
  {
    "resource": "/shares/1",
    "limitApp": "default",
    "grade": 1,
    "paramIdx": 1,
    "count": 0.0,
    "controlBehavior": 0,
    "maxQueueingTimeMs": 0,
    "burstCount": 0,
    "durationInSec": 1,
    "paramFlowItemList": [
      {
        "object": "1",
        "count": 1,
        "classType": "int"
      }
    ],
    "clusterMode": false,
    "clusterConfig": {
      "flowId": null,
      "thresholdType": 0,
      "fallbackToLocalWhenFail": true,
      "sampleCount": 10,
      "windowIntervalMs": 1000
    }
  }
]

@lltx
Copy link
Collaborator

lltx commented Jul 26, 2019

周老师 我测试了一下。如果直接用你上边JSON 是没有问题的

nacos 1.1.0
sentinel 1.6.2

如果我打开了 "clusterMode": true,"flowId" 必须要设置 才行

@fangjian0423
Copy link
Contributor

周老师 我测试了一下。如果直接用你上边JSON 是没有问题的

nacos 1.1.0

sentinel 1.6.2
如果我打开了 "clusterMode": true,"flowId" 必须要设置 才行

限流规则解析完会通过 FlowRuleUtil#isValidRule 来验证,显然少了 flowId 的规则是不合法的,直接返回了 null。 体验做的不是很好

@lltx
Copy link
Collaborator

lltx commented Jul 27, 2019

@fangjian0423

热点参数 是这个 zz
ParamFlowRuleUtil.validClusterRuleId

周老师 我测试了一下。如果直接用你上边JSON 是没有问题的

nacos 1.1.0

sentinel 1.6.2
如果我打开了 "clusterMode": true,"flowId" 必须要设置 才行

限流规则解析完会通过 FlowRuleUtil#isValidRule 来验证,显然少了 flowId 的规则是不合法的,直接返回了 null。 体验做的不是很好

热点参数这个 ParamFlowRuleUtil.validClusterRuleId

@fangjian0423
Copy link
Contributor

I remove the check code in SentinelConverter, it will be handle by Sentinel XXRuleManager.

if there is some problems in SentinelConverter, we can use custom converter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sentinel spring cloud alibaba sentinel kind/question
Projects
None yet
Development

No branches or pull requests

3 participants