open-policy-agent / open-policy-agent/java-opa-sdk
Bounded buffer with drop policy
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 16
- Forks
- 24
- Avg merge
- 8h 17m
- Merged PRs (30d)
- 15
Description
DecisionLogPlugin.DecisionLogs buffers events in a ConcurrentLinkedQueue with a soft size check (bufferLimit, default 10000) that triggers a flush only after the threshold is crossed. If uploads are slow or stuck, the buffer can grow without bound — sustained load with a failing service eventually OOMs the process.
- Add a hard cap on the in-memory buffer (configurable, separate from the flush threshold).
- When the cap is reached, drop the oldest or newest event per a configured policy (default: drop oldest, log a warning, increment a
decision_logs_droppedcounter once the metrics issue lands). - Tests: sustained writes with a stuck flush stop growing memory and surface the drops.
- Coordinates with the retry/backoff issue (a stuck upstream is exactly the case this guards).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in DecisionLogPlugin.DecisionLogs and trace the existing bufferLimit flush path and configuration. Add a separate hard cap and configurable oldest/newest drop policy, then test sustained writes with a stuck flush to verify bounded growth and surfaced drops; coordinate the decision_logs_dropped metric with the metrics issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100