open-policy-agent / open-policy-agent/java-opa-sdk

Bounded buffer with drop policy

Open
#76 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

decision-logs services
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_dropped counter 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.