codex-team / codex-team/hawk.collector
Rate limits
- Dominant language
- Go
- Stars
- 2
- Forks
- 0
- Avg merge
- 35m
- Merged PRs (30d)
- 2
Description
Implement per-project rate limiter
## Limitting
Max N events per T for Project
N and T should be configurable. The best way is to include them to the Plans so each plan can have own values
Initially set these values:
N — 5000 events
T — 5 min
After T time passed, project should continue accept events.
## Statistic
Collector should increment rate limited events counter of the project.
API should be able to get that data **grouped by hour**. We will use it to display them on the Project Events graph like this:
### Questions:
1. Where to store statistic? Mongo or Redis? Both Collector and Api should be able to access it
2. How to store statistic? For example, we can store timestamp without minutes in Mongo — 1 record for 1 hour (`workspace_id | project_id | timestamp-hourly | counter`). Or key like `rate-limited:workspaceId::projectId::`. Or something other.
3. Who should insert statistic? Collector itself or separate worker?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by examining the Collector and API paths that handle project events and the Plans configuration, then resolve the open storage and ownership questions for rate-limit statistics. Done means configurable per-project limits, the initial 5000-events-per-5-minutes values, continued acceptance after the interval, and hourly grouped rate-limit data exposed by the API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mongodb, redis
- Domain
- api, backend, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100