| domain | blackbox.ai |
| summary | The `RateLimitMetrics` class tracks request rates for rate limiting purposes. It uses AtomicLong and AtomicReference to manage allowed, blocked requests, and timestamps of allowed/blocked events. A `ConcurrentLinkedQueue` stores sample timestamps. A scheduled executor service runs a trim function to remove old samples every 1 second, keeping the sample count within a 60-second window. Methods `markAllowed` and `markBlocked` increment counters and add timestamps to the queue. `getAllowed` and `getBlocked` return the current counts. `requestsPerSecond` calculates the approximate requests per second over the last 60 seconds by filtering the queue based on time. The `trim` method removes old samples from the queue if they exceed the 60-second window. The class provides a `toString` method to represent the metrics. |
| title | BLACKBOX.AI |
| description | BLACKBOX.AI is the best ai agent, built to transform the way you work and learn and trusted by +10 M users and Fortune 500 companies |
| keywords | public, private, final, import, return, agent, void, head, rate, limiting, metrics, service, class, trim, count, break, agents |
| upstreams |
|
| downstreams |
|
| nslookup | A 34.8.133.24 |
| created | 2025-07-21 |
| updated | 2026-02-02 |
| summarized | 2026-02-03 |
|
|