Package com.tnsai.quality.ratelimit
Interface EventRateLimiter
- All Known Implementing Classes:
Resilience4jEventRateLimiter
public interface EventRateLimiter
SPI for per-tenant event rate limiting (issue #82).
Sits downstream of sampling — sampling reduces volume on average; the rate limiter is
the last-resort backstop that keeps a runaway tenant from
overwhelming the aggregator. Implementations decide per-call whether
to accept, drop, or defer an event.
Tenant scoping
TheEventContext carries the tenant identity. Implementations
are responsible for resolving the per-tenant token bucket / window
from that context. EventContext.tenantId() may be empty for
tenant-less deployments — implementations must handle that case
(typically by sharing a single global bucket).
Thread safety
Implementations MUST be safe to call concurrently — many threads publish events into the same publisher chain.- Since:
- 0.10.0 (issue #82)
-
Method Summary
-
Method Details
-
check
Decide whether the tenant can emit another event right now.- Parameters:
context- the active event context (tenant, agent, trace)- Returns:
Decision.ACCEPT,Decision.DROP, orDecision.DEFER
-