feat(limit-count): allow sharing counter#5881
Conversation
Signed-off-by: spacewander <[email protected]>
| --- error_log | ||
| [error] | ||
| --- response_body | ||
| {"error_msg":"failed to check the configuration of plugin limit-count err: group conf mismatched"} |
There was a problem hiding this comment.
How can we update the limit-count config?
There was a problem hiding this comment.
We need to update the group too. Otherwise, the same group will have two different configuration.
Co-authored-by: leslie <[email protected]>
Co-authored-by: tzssangglass <[email protected]>
Signed-off-by: spacewander <[email protected]>
| if not conf.group then | ||
| key = key .. ctx.conf_type .. ctx.conf_version | ||
| else | ||
| key = key .. conf.group |
There was a problem hiding this comment.
So traffic will eventually be limited according to the key generated by the combination of key and group.
But key can not be empty (if key is empty, remote_addr will be set as the default key),
so it is never possible to limit the rate only according to the group.
There was a problem hiding this comment.
Yes, the previous limit-count is two-dimension:
per-route x per-key
This PR allows to use:
group x per-key
If we want to limit only according to the group, we can use a constant variable, like hostname, so the per-key will be always a single point.
In the next PR, I will introduce a new key type that is equal to a constant variable, so we don't need a special configuration for the key part.
There was a problem hiding this comment.
Look like the hostname is not constant if the cluster limit-count is used. Anyway, we can solve it in the next PR.
See apache#5881 (comment) Signed-off-by: spacewander <[email protected]>
Signed-off-by: spacewander [email protected]
What this PR does / why we need it:
Fix #5342
Pre-submission checklist: