[BUG] — `alert_receiver.selectAll`: full cross-namespace scan loaded per alert dispatch
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: Low-Medium; files: `mappers/alert-receiver-sqlmap.xml:58-62` (and `Base_Column_List:53-56`, which omits `namespace_id`)
- description: `select * from alert_receiver` with no `WHERE`; `alert_receiver` has only PK. Every alert-dispatch evaluation loads all receivers (with ~20 varchar columns) into memory and matches `labels`/`levels`/`match_all` in Java.
- impact: Cost grows linearly with receiver count on every alert evaluation.
- suggested_fix: Push label/level matching into SQL with indexed columns or a join table; at minimum index `namespace_id` and filter by namespace when dispatching.
- confidence: High
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with mappers/alert-receiver-sqlmap.xml:58-62 and Base_Column_List lines 53-56, then trace the alert-dispatch evaluation that calls alert_receiver.selectAll. Check how namespace and label/level matching currently works and compare query cost and memory use. Done means dispatch no longer loads every namespace’s receivers while preserving matching behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100