feat(cli): forward perf breakdown + tmpPeakBytes to PostHog telemetry#454
feat(cli): forward perf breakdown + tmpPeakBytes to PostHog telemetry#454jrusso1020 merged 1 commit intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
miguel-heygen
left a comment
There was a problem hiding this comment.
Review: feat(cli): forward perf breakdown + tmpPeakBytes to PostHog telemetry
Clean, mechanical wiring PR. 2 files, +56/-0, all additive. No issues.
What it does
Forwards 17 new optional fields from RenderPerfSummary to PostHog's render_complete event: tmpPeakBytes, 6 stage timings, and 10 videoExtractBreakdown fields (including cache hit/miss counters from #446).
What I checked
- Naming consistency — snake_case PostHog keys match the existing pattern.
extract_phase3_msvsstage_video_extract_msdisambiguation is correct and documented in the PR body. - All fields optional — Docker-subprocess branch without a local
perfSummarystill compiles and ships events without them. Confirmed by the nullish chaining onperf?.stages,perf?.videoExtractBreakdown,perf?.tmpPeakBytes. - No naming conflicts — the
...getMemorySnapshot()spread at the end usespeak_memory_mb/memory_free_mb, no overlap with the newstage_*/extract_*keys. - Flat property layout — correct for PostHog. Nested objects would require JSON stringification and make insights queries harder.
- No cardinality concerns — all values are numeric (timings in ms, byte counts, integer counters). PostHog handles this fine.
One note (not blocking)
trackEvent will receive undefined for all 17 new properties when perf is null (the Docker-subprocess path). Most PostHog SDKs strip undefined values before sending, so this is fine — but if the SDK sends them as explicit nulls, it could clutter the event schema. Worth a quick check on the first real ingestion event (already in the test plan).
Verdict: Approve
No issues. Ship it.
8a31b2c to
3c36324
Compare
e4ef982 to
406e281
Compare
|
Rebased the stack onto current On your non-blocking observation about |
3c36324 to
a0f49f2
Compare
406e281 to
6d11a66
Compare
miguel-heygen
left a comment
There was a problem hiding this comment.
Re-checked the live stacked head. The telemetry wiring remains clean on top of the updated engine stack, local CLI validation is clean, and the latest CI is green.
a0f49f2 to
b231f61
Compare
6d11a66 to
7085490
Compare
1a669be to
ba05796
Compare
7085490 to
74112a4
Compare
74112a4 to
330b112
Compare
ba05796 to
57cdf7d
Compare
The CLI already ships `render_complete` events to PostHog but only carries a subset of `RenderPerfSummary` (duration_ms, capture_avg_ms, etc.). With #444 adding per-phase breakdown and #446 adding cache counters, the data is sitting in `job.perfSummary.videoExtractBreakdown` and `job.perfSummary.tmpPeakBytes` but never reaching PostHog. This forwards the new fields as flat properties (flat is easier to query with PostHog insights than nested objects): - tmp_peak_bytes - stage_compile_ms, stage_video_extract_ms, stage_audio_process_ms, stage_capture_ms, stage_encode_ms, stage_assemble_ms - extract_resolve_ms, extract_hdr_probe_ms, extract_hdr_preflight_ms, extract_hdr_preflight_count, extract_vfr_probe_ms, extract_vfr_preflight_ms, extract_vfr_preflight_count, extract_phase3_ms, extract_cache_hits, extract_cache_misses `extract_phase3_ms` disambiguates from `stage_video_extract_ms`: the former is just the parallel ffmpeg extract inside Phase 3, the latter is the full stage (resolve + probe + preflight + extract). All fields optional — the Docker subprocess call site (no perfSummary available) still compiles and ships events without them.
330b112 to
3760bae
Compare
Merge activity
|

What
Forwards the new per-phase extraction breakdown and
tmpPeakBytesfields fromRenderPerfSummary(added in #444 and #446) to PostHog via the CLI's existingrender_completetelemetry event.Why
The CLI already ships
render_completeevents to PostHog (packages/cli/src/telemetry/client.ts), butevents.ts:trackRenderCompleteonly carried a subset ofRenderPerfSummary— top-level timings, composition dims, and memory snapshots. After #444 added per-phase extraction breakdown (videoExtractBreakdown) and #446 added cache hit/miss counters, the data lives onjob.perfSummaryat render-complete but never reaches PostHog dashboards.Without this, any PostHog insight built around "how often are we hitting the cache?", "what's the median HDR preflight cost?", or "where in the extract phase do compositions spend time?" has to be answered by Datadog log scraping instead.
How
packages/cli/src/telemetry/events.ts— extendtrackRenderCompleteprops with 17 new optional fields:tmpPeakBytes, the six named stage timings, and the tenvideoExtractBreakdownfields. All sent as flat properties (extract_cache_hits,stage_capture_ms, etc.) — PostHog insights query flat keys more ergonomically than nested objects.packages/cli/src/commands/render.ts— wirejob.perfSummary.videoExtractBreakdown/stages/tmpPeakBytesinto thetrackRenderMetrics→trackRenderCompletehand-off.extract_phase3_msdeliberately disambiguates fromstage_video_extract_ms— the former is just the parallel ffmpeg extract inside Phase 3; the latter is the full stage (resolve + probe + preflight + extract).render.tsthat doesn't have a localperfSummarystill compiles and ships events without them.Test plan
bun run --cwd packages/cli test— 161/161 passbunx tsc -p packages/cli/tsconfig.json --noEmit— no errorsbunx oxlint+bunx oxfmt— cleanhyperframes renderagainst a fixture and watch PostHog ingestion — telemetry auto-disables in CI, so this requires a local dev render withHYPERFRAMES_NO_TELEMETRYunset).Stack
Depends on #444 (adds the
videoExtractBreakdown+tmpPeakBytesfields toRenderPerfSummary) and transitively on #445 → #446.Future work (not in this PR)
hyperframes-internal/packages/producer/src/server.ts) logsperfSummaryto Datadog vialog.infobut has no PostHog integration. Production renders are the bulk of the traffic — separate PR to either ship perfSummary to PostHog from the internal server, or materialize Datadog log-based metrics for per-phase timings.