Skip to content

feat: implement is_negative_hits in rate limit descriptor#1140

Open
rudrakhp wants to merge 1 commit into
envoyproxy:mainfrom
rudrakhp:main
Open

feat: implement is_negative_hits in rate limit descriptor#1140
rudrakhp wants to merge 1 commit into
envoyproxy:mainfrom
rudrakhp:main

Conversation

@rudrakhp
Copy link
Copy Markdown
Member

Summary

Add support for the is_negative_hits field on rate limit descriptors. When set, the
hits_addend value decrements the rate limit counter instead of incrementing it, effectively
refilling previously consumed tokens. The counter is floored at 0 (cannot go negative).

  • Upgrade go-control-plane/envoy to v1.37.1 (adds IsNegativeHits proto field)
  • Redis: uses an atomic Lua script (EVAL) to decrement and floor at 0 in a single operation
  • Memcached: uses native Decrement which floors at 0 by default
  • Negative hits bypass over-limit and near-limit checks (always return OK)
  • New total_negative_hits stat tracks requested decrements per descriptor

Fixes envoyproxy/envoy#41219

Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable per-user concurrency limits by supporting negative cost in the rate limiting protocol

1 participant