-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(limit-count): allow sharing counter #5881
Conversation
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
--- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we update the limit-count config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update the group too. Otherwise, the same group will have two different configuration.
Co-authored-by: leslie <59061168+leslie-tsang@users.noreply.github.com>
Co-authored-by: tzssangglass <tzssangglass@gmail.com>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <spacewanderlzx@gmail.com>
Signed-off-by: spacewander spacewanderlzx@gmail.com
What this PR does / why we need it:
Fix #5342
Pre-submission checklist: