alibaba / Sentinel

A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
https://sentinelguard.io/
Apache License 2.0
22.4k stars 8.03k forks source link

Expand more statistic dimensions( such as 20s, 1min, 20min), not only for 1 second | 流控规则支持自定义统计时长 #263

Open ro9er opened 5 years ago

ro9er commented 5 years ago

Issue Description

feature request

Describe what happened (or what feature you want)

In some situation, we want to perform flow control not only based on the statistics of 1 second. For example, as for some origin/callers, we wanna count the call times in 1 minute and block the caller if the count exceeds the threshold. Sentinel does not support this kind of statistics.

Describe what you expected to happen

Sentinel supports more statistic dimension of unit. It would be perfect if programmers can build the statistic rule by setting count parameters.

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

Anything else we need to know?

sczyh30 commented 5 years ago

This is a good idea giving users more flexible strategy. Any thoughts on its implementation?

ro9er commented 5 years ago

Maybe one way to implement that is make one resource contains N clusterNode, which correspond to one time dimension rule. For example, if one resource has 4 rules and the statistic unit is 1s 1s 20s 20min, the resource will have 3 cluster Node. And we perform flow control on that. Another way is that we use just one clusterNode based on 1s like now. And if we want to support more statistic dimension, we log the statistic per second by retrieving the clusternode per second or on requests entering.