Skip to content

feat(limit-count): support configuring multiple rules#12977

Merged
shreemaan-abhishek merged 8 commits intoapache:masterfrom
shreemaan-abhishek:chore/multi-rule
Feb 10, 2026
Merged

feat(limit-count): support configuring multiple rules#12977
shreemaan-abhishek merged 8 commits intoapache:masterfrom
shreemaan-abhishek:chore/multi-rule

Conversation

@shreemaan-abhishek
Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek commented Feb 5, 2026

Description

After adding the support for usage of variables in rate limiting configuration via #12967, we can further take advantage of this dynamic construction of rate limiting rule by allowing to configure multiple rate limiting rules to implement intricate rate limiting strategies.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Feb 5, 2026
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
| time_window | integer | True | | > 0 | The time interval corresponding to the rate limiting `count` in seconds. |
| count | integer | False | | > 0 | The maximum number of requests allowed within a given time interval. Required if `rules` is not configured. |
| time_window | integer | False | | > 0 | The time interval corresponding to the rate limiting `count` in seconds. Required if `rules` is not configured. |
| rules | array[object] | False | | | A list of rate limiting rules. Each rule is an object containing `count`, `time_window`, and `key`. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add rows for rules.count, rules.time_winddow, and rules.key.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
membphis
membphis previously approved these changes Feb 6, 2026
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only one minor issue


core.log.info("limit count: ", count, ", time_window: ", time_window)
local function create_limit_obj(conf, rule, plugin_name)
core.log.info("create new " .. plugin_name .. " plugin instance",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
core.log.info("create new " .. plugin_name .. " plugin instance",
core.log.info("create new ", plugin_name, " plugin instance",

Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Copy link
Member

@kayx23 kayx23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc changes lgtm

@shreemaan-abhishek shreemaan-abhishek merged commit d6e288b into apache:master Feb 10, 2026
25 of 26 checks passed
@shreemaan-abhishek shreemaan-abhishek deleted the chore/multi-rule branch February 10, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants