mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 17:30:50 +00:00
Follow-up to the render-reliability batch (#1841/#1842/#1843). Threads two capture-reliability counters through the existing observability → CLI-telemetry pipeline (no new PostHog wiring) so #1842's hardening is measurable on dashboard 1783183: - transient-retry burn (CaptureAttemptSummary.reason gains "transient-retry"; counted into RenderCaptureObservability.transientRetries on BOTH the recovered and the still-failed paths via a shared helper). - OOM classification (memoryExhaustionDetected set when describeMemoryExhaustion classifies the failure). Surfaced as capture_transient_retries + capture_memory_exhaustion_detected render-event props. Tests cover the attempt tagging and the payload mapping. Further follow-up (different subsystems): encoder-frame-0-exit signal, and P1-3 pre-flight-rejection / P1-4 cli_env_check counters. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { RenderObservabilitySummary } from "@hyperframes/producer";
|
|
import { renderObservabilityTelemetryPayload } from "./renderObservability.js";
|
|
|
|
function makeSummary(
|
|
capture: Partial<RenderObservabilitySummary["capture"]>,
|
|
): RenderObservabilitySummary {
|
|
return {
|
|
events: [],
|
|
eventCount: 0,
|
|
browserDiagnostics: {
|
|
total: 0,
|
|
errors: 0,
|
|
pageErrors: 0,
|
|
requestFailed: 0,
|
|
httpErrors: 0,
|
|
navigationStarts: 0,
|
|
navigationFailures: 0,
|
|
consoleErrors: 0,
|
|
consoleWarnings: 0,
|
|
},
|
|
capture: { forceScreenshot: false, captureMode: "beginframe", ...capture },
|
|
};
|
|
}
|
|
|
|
describe("renderObservabilityTelemetryPayload — render-reliability counters", () => {
|
|
it("maps the transient-retry and OOM counters through to the telemetry payload", () => {
|
|
const payload = renderObservabilityTelemetryPayload(
|
|
makeSummary({ transientRetries: 2, memoryExhaustionDetected: true }),
|
|
);
|
|
expect(payload.captureTransientRetries).toBe(2);
|
|
expect(payload.captureMemoryExhaustionDetected).toBe(true);
|
|
});
|
|
|
|
it("leaves the counters undefined when the render didn't retry or OOM", () => {
|
|
const payload = renderObservabilityTelemetryPayload(makeSummary({}));
|
|
expect(payload.captureTransientRetries).toBeUndefined();
|
|
expect(payload.captureMemoryExhaustionDetected).toBeUndefined();
|
|
});
|
|
});
|