[History server] Implement disk-first event storage pipeline to reduce collector memory #4874
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 285 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.338
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4874"
general
weight: 0.35
KunWuLuan
Why are these changes needed?
The event collector buffered all incoming events in memory (
map[string][]Event) and flushed them periodically as a JSON array. This has two problems:1. memory grows unbounded with event volume
2. a collector crash loses everything not yet flushed
This PR replaces the in-memory buffer with a disk-first pipeline:
POST /v1/events-> append to local JSONL -> rotate -> (optional gzip) -> upload -> delete localTo store events in disk rather than memory before uploading to object store. On startup, leftover
.jsonl/.jsonl.gzfiles from a previous run are re-uploaded. Failed uploads are retried with backoff; files are only deleted locally after a successful upload.Behavior details
- Durability:
200 OKmeans the events are on local disk. Disk usage above 80% of--event-max-disk-mbreturns503 + Retry-Afterso the dashboard agent retries instead of dropping events.--event-rotation-interval), file size (--event-max-file-size-mb), session change, node ID change, and shutdown..../{session}/{nodeID}/node_events/...and.../{session}/{nodeID}/job_events/{jobID}/...Flags update
--event-flush-intervalis removed (no in-memory buffer to flush).--event-compression-enabledis retained but now only controls whether rotated files are gzipped before upload.New flags (all with env-var overrides):
--event-data-dir,--event-rotation-interval,--event-max-file-size-mb,--event-max-disk-mbExtra fix
GetContentin the Aliyun OSS backend was missing theOssRootDir/clusterIdprefix, soGetObject404'd on paths thatListFileshad returned successfully.Related issue number
Part of #4706
Checks
- [x] Unit tests
- [x] Manual tests
- [ ] This PR is not tested :(