Skip to content

Rate limits #113

@neSpecc

Description

@neSpecc

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:

image

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:<wid>:projectId:<pid>:<timestamp-hourly>. Or something other.
  3. Who should insert statistic? Collector itself or separate worker?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions