Skip to content

feat: OOM rejection visibility#261

Merged
kacy merged 1 commit intomainfrom
feat/oom-visibility
Feb 24, 2026
Merged

feat: OOM rejection visibility#261
kacy merged 1 commit intomainfrom
feat/oom-visibility

Conversation

@kacy
Copy link
Copy Markdown
Owner

@kacy kacy commented Feb 24, 2026

summary

operators currently have no visibility when memory limits reject writes. this adds rate-limited logging and a prometheus metric so ops teams can detect and alert on memory pressure.

  • oom_rejections counter on Keyspace, incremented when enforce_memory_limit returns false
  • warn! log on first rejection + every 1000th (includes used bytes, limit, requested size)
  • ember_oom_rejections_total prometheus gauge, polled alongside existing keyspace stats
  • oom_rejections field in INFO stats output

what was tested

  • all unit tests pass across workspace
  • clippy clean on emberkv-core
  • verified KeyspaceStats struct initialization updated in all three construction sites (keyspace, connection INFO, metrics poller)

design considerations

  • counter lives on Keyspace (same as evicted_total and expired_total) for consistency
  • rate-limiting at 1st + every 1000th avoids log flooding under sustained memory pressure
  • no hot-path impact: the increment is on the OOM rejection path only, never on successful writes

adds observability for memory limit rejections:

- new `oom_rejections` counter on Keyspace, tracked incrementally
- rate-limited warn! log on rejection (first + every 1000th) with
  used_bytes, limit, requested size, and total rejections
- exported as `ember_oom_rejections_total` prometheus gauge
- included in INFO stats output as `oom_rejections`
- aggregated across shards in both metrics poller and INFO handler
@kacy kacy merged commit 510a5c2 into main Feb 24, 2026
@kacy kacy deleted the feat/oom-visibility branch February 24, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant