Skip to content

limit/rate: add rate() and is_limited() inspector methods on RateLimit service - #880

Open
Aditya-9-6 wants to merge 1 commit into
tower-rs:masterfrom
Aditya-9-6:feature/rate-limiter-capacity-reserve
Open

limit/rate: add rate() and is_limited() inspector methods on RateLimit service#880
Aditya-9-6 wants to merge 1 commit into
tower-rs:masterfrom
Aditya-9-6:feature/rate-limiter-capacity-reserve

Conversation

@Aditya-9-6

Copy link
Copy Markdown

Summary

This PR adds public inspector methods rate(&self) and is_limited(&self) to RateLimit<T> in tower/src/limit/rate/service.rs.

Rationale & Value

Currently, callers using tower::limit::RateLimit cannot inspect the rate configuration or check if the rate limiter is in State::Limited without polling the service.

Adding rate(&self) and is_limited(&self):

  • Exposes zero-cost state inspection for metrics, logging, and health checks.
  • Avoids forcing unnecessary poll_ready state transitions when inspecting rate limiter status.

…t service

Signed-off-by: Aditya <adityadahale96@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.

1 participant