Skip to content

Commit 7e3bcd9

Browse files
vanceingallsclaude
andauthored
feat(producer): host/render telemetry in RenderPerfSummary (#1551)
Adds a `host` block (platform, arch, cpuCount, totalMemMb, nodeVersion, gpuDisabled) to RenderPerfSummary so fleet-wide telemetry can correlate render performance with the machine it ran on — chiefly cpuCount vs the existing `workers` field (core over/under-subscription) and totalMemMb vs lowMemoryMode / single-worker collapse. Capture mode + GPU mode already surface via `observability`; this fills in the missing host facts. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 1ff99a5 commit 7e3bcd9

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

‎packages/producer/src/services/render/perfSummary.test.ts‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, it } from "vitest";
2-
import { roundDb } from "./perfSummary.js";
2+
import { buildRenderPerfSummary, roundDb } from "./perfSummary.js";
3+
import type { RenderJob } from "../renderOrchestrator.js";
34

45
describe("roundDb", () => {
56
it("rounds to 1 decimal", () => {
@@ -20,3 +21,46 @@ describe("roundDb", () => {
2021
expect(roundDb(roundDb(28.4373))).toBe(28.4);
2122
});
2223
});
24+
25+
// ponytail: minimal stub — only the fields buildRenderPerfSummary reads are real.
26+
const baseInput = {
27+
job: { id: "r1", config: { fps: { num: 30, den: 1 }, quality: "high" } } as unknown as RenderJob,
28+
workerCount: 4,
29+
enableChunkedEncode: false,
30+
chunkedEncodeSize: 0,
31+
compositionDurationSeconds: 5,
32+
totalFrames: 150,
33+
outputWidth: 1920,
34+
outputHeight: 1080,
35+
videoCount: 0,
36+
audioCount: 0,
37+
totalElapsedMs: 1234,
38+
perfStages: {},
39+
videoExtractBreakdown: undefined,
40+
tmpPeakBytes: 0,
41+
captureAttempts: [],
42+
hdrDiagnostics: { videoExtractionFailures: 0, imageDecodeFailures: 0 },
43+
peakRssBytes: 0,
44+
peakHeapUsedBytes: 0,
45+
dedupPerfs: [],
46+
};
47+
48+
describe("buildRenderPerfSummary host telemetry", () => {
49+
it("captures host facts and threads gpuDisabled through", () => {
50+
const summary = buildRenderPerfSummary({ ...baseInput, gpuDisabled: true });
51+
expect(summary.host).toBeDefined();
52+
expect(summary.host?.gpuDisabled).toBe(true);
53+
expect(summary.host?.cpuCount).toBeGreaterThan(0);
54+
expect(summary.host?.totalMemMb).toBeGreaterThan(0);
55+
expect(summary.host?.platform).toBe(process.platform);
56+
expect(summary.host?.arch).toBe(process.arch);
57+
expect(summary.host?.nodeVersion).toBe(process.version);
58+
});
59+
60+
it("reflects gpuDisabled=false", () => {
61+
const summary = buildRenderPerfSummary({ ...baseInput, gpuDisabled: false });
62+
expect(summary.host?.gpuDisabled).toBe(false);
63+
// workers vs cores is the headline correlation — both must be present.
64+
expect(summary.workers).toBe(4);
65+
});
66+
});

‎packages/producer/src/services/render/perfSummary.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* the `perf-summary.json` debug artifact.
44
*/
55

6+
import { arch, cpus, platform, totalmem } from "node:os";
67
import { fpsToNumber } from "@hyperframes/core";
78
import type { CapturePerfSummary, SubTimelineWaitOutcome, WorkerSizing } from "@hyperframes/engine";
89
import type { CaptureCalibrationSample, CaptureCostEstimate } from "./captureCost.js";
@@ -221,6 +222,8 @@ export function buildRenderPerfSummary(input: {
221222
/** Per-session/per-worker static-dedup perf; aggregated into `staticDedup`. */
222223
dedupPerfs: CapturePerfSummary[];
223224
drawElement?: DrawElementPerfInput;
225+
/** `cfg.disableGpu` — the hard `--disable-gpu` flag, for the `host` GPU picture. */
226+
gpuDisabled: boolean;
224227
}): RenderPerfSummary {
225228
return {
226229
renderId: input.job.id,
@@ -282,5 +285,13 @@ export function buildRenderPerfSummary(input: {
282285
input.dedupPerfs,
283286
input.drawElement ?? { selfVerifyFallback: false },
284287
),
288+
host: {
289+
platform: platform(),
290+
arch: arch(),
291+
cpuCount: cpus().length,
292+
totalMemMb: Math.round(totalmem() / (1024 * 1024)),
293+
nodeVersion: process.version,
294+
gpuDisabled: input.gpuDisabled,
295+
},
285296
};
286297
}

‎packages/producer/src/services/renderOrchestrator.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,27 @@ export interface RenderPerfSummary {
546546
/** Per-frame "No cached paint record" screenshot fallbacks. */
547547
ncprFallbacks: number;
548548
};
549+
/**
550+
* Render-host facts, captured from the orchestrator process. Lets fleet-wide
551+
* telemetry correlate render performance with the machine it ran on — most
552+
* importantly `cpuCount` vs the top-level `workers` (are we under-/over-
553+
* subscribing cores?) and `totalMemMb` (does `lowMemoryMode` / single-worker
554+
* collapse track real memory pressure?). `gpuDisabled` completes the GPU
555+
* picture alongside `observability.browserGpuMode`.
556+
*
557+
* Reflects the ORCHESTRATOR host. For distributed renders the chunk workers
558+
* may run on different machines; this is still the right signal for the
559+
* common single-machine render. Optional for back-compat with serialized
560+
* older summaries.
561+
*/
562+
host?: {
563+
platform: string;
564+
arch: string;
565+
cpuCount: number;
566+
totalMemMb: number;
567+
nodeVersion: string;
568+
gpuDisabled: boolean;
569+
};
549570
}
550571

551572
export interface HdrDiagnostics {
@@ -3971,6 +3992,7 @@ async function executeRenderPipeline(input: {
39713992
observability: observabilitySummary,
39723993
peakRssBytes: memSampler.peakRssBytes(),
39733994
peakHeapUsedBytes: memSampler.peakHeapUsedBytes(),
3995+
gpuDisabled: cfg.disableGpu,
39743996
});
39753997
job.perfSummary = perfSummary;
39763998
if (job.config.debug) {

0 commit comments

Comments
 (0)