dotCMS / dotCMS/core

Add per-customer rate limiting to analytics ingestion endpoint using Bucket4j

Open
#35,071 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Analytics Priority : 4 Low stale Team : Falcon Type : Task
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Add per-customer rate limiting to the ingestion endpoint using Bucket4j (in-process, token bucket algorithm). Each customerId gets its own bucket. When the bucket is exhausted, return 429 Too Many Requests. Rate limit parameters (capacity, refill rate) must be configurable — not hardcoded.

Improvement plan: https://docs.google.com/document/d/1hVfIurPqAJJ1PN1EalmvrWXnGNt5sY21MI-409lrXpU/edit?tab=t.klqavlz4cis7#heading=h.8vek9yxwq8yt

Parent epic: #35048

Acceptance Criteria

  • Bucket4j added as a dependency
  • Each customerId gets its own in-process token bucket
  • Rate limiting enforced on the ingestion endpoint only
  • Exhausted bucket returns 429 Too Many Requests
  • Rate limit capacity and refill rate configurable via application.yml (not hardcoded)
  • Web layer test added: rate-limited request returns 429
  • Rejection logged with structured JSON

Additional Context

  • Source task: Task 19 (Per-customer rate limiting) from the improvement plan
  • Parallelizable after Phase 1 — blocked by: #35050
  • Implementation: in-process only (no Redis); swappable to distributed later if needed
  • Related branch: issue-34849-Add-dotCMS-Analytics-Proxy-Endpoint-for-/v1/analytics/-to-dot-ca-event-manager

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the analytics ingestion endpoint and inspect the related branch and blocking issue #35050 before changing behavior. Review application.yml for configurable capacity and refill settings, then add the requested web-layer test for a 429 response and verify structured rejection logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.