fix(balanceworker): skip events that dont match meters#4279
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded an early-return guard in handleBatchedIngestEvent: if event.MeterSlugs is empty the function logs an info and returns nil immediately, skipping entitlement lookups and any entitlement-recalculation publishing. ChangesEarly Return Guard for Empty Meter Slugs
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@openmeter/entitlement/balanceworker/ingesthandler.go`:
- Around line 21-25: The InfoContext log in the early-return branch currently
logs the entire event (event) which can include RawEvents; instead change the
log to trim the payload by logging only safe summary fields such as
event.Namespace, event.Subject (or subject identifier field), and the meter
count (len(event.MeterSlugs)); update the call to w.opts.Logger.InfoContext(ctx,
...) in the same block so it does not pass the full event object but these
minimal fields to avoid leaking raw payloads.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cf392d18-b96e-476a-a8c6-1a3c00e08fac
📒 Files selected for processing (1)
openmeter/entitlement/balanceworker/ingesthandler.go
ec1c5e8
Overview
Events can be ingested that don't match any meters
Summary by CodeRabbit