Summary
Currently, postRunAnalytics and the root cli.PersistentPostRun use fire-and-forget goroutines (go analytics.PostRunAnalytics(...)) without any synchronization. This is an intentional trade-off — blocking on analytics network I/O made fast CLI commands feel slow — but it means analytics events can be silently dropped when the process exits before the goroutine runs.
Goal
Explore a non-blocking but more reliable delivery mechanism, for example:
- Buffering events to a local file/queue and flushing them on the next CLI invocation.
- Using a short, bounded timeout (e.g., 200–500 ms) to allow the goroutine to finish without meaningfully impacting UX.
- Any other approach that preserves CLI responsiveness while reducing event loss.
Context
Acceptance Criteria
- Analytics goroutines do not cause noticeable latency increase for fast CLI commands.
- Event loss rate is reduced compared to the current best-effort approach.
Summary
Currently,
postRunAnalyticsand the rootcli.PersistentPostRunuse fire-and-forget goroutines (go analytics.PostRunAnalytics(...)) without any synchronization. This is an intentional trade-off — blocking on analytics network I/O made fast CLI commands feel slow — but it means analytics events can be silently dropped when the process exits before the goroutine runs.Goal
Explore a non-blocking but more reliable delivery mechanism, for example:
Context
Acceptance Criteria