codeflash-internal/js/cf-webapp/roadmap.png
Kevin Turcios 566424e97f
feat: add server action timing and expand PostHog analytics (#2552)
## Summary

- Add `withTiming()` wrapper for server actions with Sentry span
reporting and slow action warnings (>1s)
- Add centralized `captureEvent()` helper for PostHog tracking
- Add 5 new PostHog tracking events: optimization_reviewed,
repository_connected, api_key_created, member_invited,
billing_page_viewed
- Instrument 4 server actions with `withTiming()`:
getOrganizationMembers, getRepositoryById,
getRepositoriesWithStagingEvents, getAllOptimizationEvents

## Proof of Correctness

See
[`js/cf-webapp/proof/08-server-action-timing.md`](js/cf-webapp/proof/08-server-action-timing.md)

## How to Verify

```bash
cd js/cf-webapp
bash proof/reproducers/08-server-action-timing.sh
```

21 checks verify: withTiming utility, 4 instrumented actions,
captureEvent helper, 5 tracking functions, and all tracking calls wired
into action files.

## Test Plan

- [ ] Run reproducer: `bash
proof/reproducers/08-server-action-timing.sh` (21/21 pass)
- [ ] Verify server actions still work correctly
- [ ] Check Sentry for `server.action` spans after deployment
2026-04-04 11:34:53 -05:00

511 KiB
1512x2676px