Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ tmp/
# Local documentation-site outputs.
site/dist/
site/.astro/
site/src/assets/landing/*.webm
site/src/assets/landing/*.mp4

# Local browser-test outputs.
ui/host/playwright-report/
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ ui/host/test-results/
# Documentation site workspace outputs.
site/dist/
site/.astro/
site/src/assets/landing/*.webm
site/src/assets/landing/*.mp4

# Test/temp
# Root-scoped: a bare `testdata/` would also ignore Go package fixtures, which
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ canonical guards included in that script. `just site-build` also installs site
dependencies; use the installed build directly when dependency installation is
outside the verification environment's scope. Neither command publishes the site.

Refresh the landing page’s light and dark product captures with `rtk just landing-captures` (real seeded server and local Chrome); to capture a real workload on an existing instance such as Fanout v2026.10.7-alpha through a local tunnel, set `FANOUT_LANDING_BASE_URL=http://127.0.0.1:17520` and `FANOUT_LANDING_SESSION_COOKIE` to the `name=value` session cookie from first-admin setup before running the same command (no server startup or seed, default live dashboard range, and a complete trace with at least 10 spans across 3 services, preferring success).
Refresh the README's light and dark System overview captures with `just landing-captures` (real seeded server and local Chrome). To capture an existing instance such as the live demo, set `FANOUT_LANDING_BASE_URL` to its URL and `FANOUT_LANDING_SESSION_COOKIE` to a `name=value` session cookie before running the same command; no server starts and no data is seeded. The landing page's chat and dashboard clips are recorded the same way with `FANOUT_LANDING_RECORDINGS=1`; see `site/scripts/landing-recordings.md`.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ e2e *ARGS:
just build
cd ui/host && bun run e2e {{ARGS}}

# Refresh the six real product captures used by the landing page.
# Refresh the README's light and dark System overview captures.
landing-captures:
FANOUT_LANDING_BASE_URL="${FANOUT_LANDING_BASE_URL:-}" FANOUT_LANDING_SESSION_COOKIE="${FANOUT_LANDING_SESSION_COOKIE:-}" FANOUT_LANDING_CAPTURES=1 just e2e e2e/landing-captures.spec.ts

Expand Down
3 changes: 2 additions & 1 deletion site/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
// The separator between a page's title and the site's: "Install · Fanout".
titleDelimiter: "·",
description:
"One binary that ingests OpenTelemetry, stores it, and answers questions about it.",
"Send OpenTelemetry to one binary. Investigate with Fanout's built-in agent, or connect yours over MCP.",
social: [
{
icon: "github",
Expand All @@ -49,6 +49,7 @@ export default defineConfig({
},
customCss: ["./src/styles/fanout.css"],
components: {
SocialIcons: "./src/components/SocialIcons.astro",
// Advertises the Markdown alternate for the current page, so an agent
// that reads the HTML head never has to parse the HTML body.
Head: "./src/components/Head.astro",
Expand Down
5 changes: 3 additions & 2 deletions site/scripts/check-benchmark-numbers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ for (const relative of files) {
equal(relative, "sustained/preview items/s", amount(match[1]), benchmark.sustained.accepted_per_second);
rates++;
}
// A throughput heading cannot silently disappear from the prose contract.
if (!rates) failures.push(`${relative}: missing authored headline items/s`);
// The landing replay renders its headline directly from the benchmark data.
const dataHeadline = relative === "../src/content/docs/index.mdx" && /^<ThroughputReplay \/>$/m.test(source);
if (!rates && !dataHeadline) failures.push(`${relative}: missing authored headline items/s`);
const perSignal = [
["spans", benchmark.sustained.spans_per_second],
["log records", benchmark.sustained.log_records_per_second],
Expand Down
35 changes: 35 additions & 0 deletions site/scripts/clip-timeline.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** Merge concurrent tool/model waits so no source frame is compressed twice. Frames before from are cut. */
export function clipSegments(waits, duration, from = 0) {
if (!Number.isFinite(duration) || duration <= 0) throw new Error("Video duration must be positive");
if (!Number.isFinite(from) || from < 0 || from >= duration) throw new Error("Clip start must be within the raw video");
if (!Array.isArray(waits)) throw new Error("Timeline waits must be an array");
const intervals = waits.map(({ start, end }) => {
if (!Number.isFinite(start) || !Number.isFinite(end) || start < 0 || end <= start) {
throw new Error("Wait intervals must have finite seconds with 0 <= start < end");
}
if (end > duration + 0.25) throw new Error("Wait interval extends past the raw video");
return { start: Math.max(from, Math.min(start, duration)), end: Math.min(end, duration) };
}).filter(({ start, end }) => end > start).sort((a, b) => a.start - b.start);
const merged = [];
for (const interval of intervals) {
const previous = merged.at(-1);
if (previous && interval.start <= previous.end) previous.end = Math.max(previous.end, interval.end);
else merged.push({ ...interval });
}
const segments = [];
let cursor = from;
for (const { start, end } of merged) {
if (start > cursor) segments.push({ start: cursor, end: start, seconds: start - cursor });
if (end > start) segments.push({ start, end, seconds: Math.min(0.6, end - start) });
cursor = end;
}
if (cursor < duration) segments.push({ start: cursor, end: duration, seconds: duration - cursor });
return segments;
}

export function clipFilter(segments) {
const filters = segments.map(({ start, end, seconds }, index) =>
`[0:v]trim=start=${start}:end=${end},setpts=(PTS-STARTPTS)*${seconds / (end - start)}[v${index}]`);
filters.push(`${segments.map((_, index) => `[v${index}]`).join("")}concat=n=${segments.length}:v=1:a=0,scale=1280:800,fps=30,format=yuv420p[out]`);
return filters.join(";\n");
}
55 changes: 55 additions & 0 deletions site/scripts/encode-clips.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { spawnSync } from "node:child_process";
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
import { mkdir } from "node:fs/promises";
import { tmpdir } from "node:os";
import { basename, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { clipFilter, clipSegments } from "./clip-timeline.mjs";

const input = resolve(process.argv[2] ?? fileURLToPath(new URL("../../ui/host/test-results/landing-recordings/", import.meta.url)));
const output = resolve(process.argv[3] ?? fileURLToPath(new URL("../src/assets/landing/", import.meta.url)));
const temporary = mkdtempSync(join(tmpdir(), "fanout-clips-"));
function run(command, args, capture = false) {
const result = spawnSync(command, args, { encoding: "utf8", stdio: capture ? ["ignore", "pipe", "inherit"] : "inherit" });
if (result.error) throw result.error;
if (result.status !== 0) throw new Error(`${command} exited with status ${result.status}`);
return result.stdout;
}

try {
await mkdir(output, { recursive: true });
// Encode every recording present, so a single retake needs no other takes.
const names = ["chat", "dashboard"].flatMap(view => ["light", "dark"].map(theme => `${view}-${theme}`))
.filter(name => existsSync(join(input, `${name}.json`)));
if (!names.length) throw new Error(`No recordings found in ${input}`);
for (const name of names) {
const timeline = JSON.parse(readFileSync(join(input, `${name}.json`), "utf8"));
if (timeline.version !== 1 || timeline.raw_file !== `${name}.webm` || basename(timeline.raw_file) !== timeline.raw_file) {
throw new Error(`Invalid recording timeline for ${name}`);
}
const raw = join(input, timeline.raw_file);
const probe = JSON.parse(run("ffprobe", ["-v", "error", "-show_entries", "format=duration:stream=width,height", "-of", "json", raw], true));
if (!probe.streams.some(stream => stream.width === 1280 && stream.height === 800)) throw new Error(`${name} must be recorded at 1280 × 800`);
const segments = clipSegments(timeline.waits, Number(probe.format.duration), timeline.start);
const seconds = segments.reduce((sum, segment) => sum + segment.seconds, 0);
// Reserve 5% of a decimal 4 MB target for muxing; two passes share this budget.
const bitrate = String(Math.floor(4_000_000 * 8 * 0.95 / seconds));
const filter = clipFilter(segments);
for (const format of ["webm", "mp4"]) {
const passlog = join(temporary, `${name}-${format}`);
const codec = format === "webm"
? ["-c:v", "libvpx-vp9", "-deadline", "good", "-cpu-used", "2", "-row-mt", "1"]
: ["-c:v", "libx264", "-preset", "slow"];
const args = ["-hide_banner", "-loglevel", "warning", "-y", "-i", raw,
"-filter_complex", filter, "-map", "[out]", "-an", ...codec, "-b:v", bitrate, "-passlogfile", passlog];
run("ffmpeg", [...args, "-pass", "1", "-f", "null", "-"]);
run("ffmpeg", [...args, "-pass", "2", ...(format === "mp4" ? ["-movflags", "+faststart"] : []), join(output, `${name}.${format}`)]);
}
// Reverse only the final second so the PNG is the last encoded frame.
run("ffmpeg", ["-hide_banner", "-loglevel", "warning", "-y", "-sseof", "-1", "-i", join(output, `${name}.mp4`),
"-vf", "reverse", "-frames:v", "1", "-update", "1", join(output, `${name}.png`)]);
console.log(`${name}: ${seconds.toFixed(1)} s, 1280 × 800, 30 fps, approximately 4 MB per format`);
}
} finally {
rmSync(temporary, { recursive: true, force: true });
}
4 changes: 4 additions & 0 deletions site/scripts/encode-clips.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

node "$(dirname "$0")/encode-clips.mjs" "$@"
18 changes: 18 additions & 0 deletions site/scripts/fixtures/landing-media.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"chat-dark": {
"mp4": "https://assets.fanout.run/landing/chat-dark-0123456789ab.mp4",
"webm": "https://assets.fanout.run/landing/chat-dark-0123456789ab.webm"
},
"chat-light": {
"mp4": "https://assets.fanout.run/landing/chat-light-0123456789ab.mp4",
"webm": "https://assets.fanout.run/landing/chat-light-0123456789ab.webm"
},
"dashboard-dark": {
"mp4": "https://assets.fanout.run/landing/dashboard-dark-0123456789ab.mp4",
"webm": "https://assets.fanout.run/landing/dashboard-dark-0123456789ab.webm"
},
"dashboard-light": {
"mp4": "https://assets.fanout.run/landing/dashboard-light-0123456789ab.mp4",
"webm": "https://assets.fanout.run/landing/dashboard-light-0123456789ab.webm"
}
}
32 changes: 32 additions & 0 deletions site/scripts/landing-media.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { hasProductVideo } from "../src/components/landing/landing-media.ts";

const fixture = JSON.parse(readFileSync(new URL("./fixtures/landing-media.json", import.meta.url), "utf8"));

test("playback requires both formats in both themes, independently for each view", () => {
for (const view of ["chat", "dashboard"]) {
const sources = ["light", "dark"].flatMap(theme => ["webm", "mp4"].map(format => [`${view}-${theme}`, format]));
for (let mask = 0; mask < 16; mask++) {
const manifest = structuredClone(fixture);
sources.forEach(([name, format], index) => { if (!(mask & (1 << index))) delete manifest[name][format]; });
assert.equal(hasProductVideo(manifest, view), mask === 15, `${view}: ${mask}`);
assert.equal(hasProductVideo(manifest, view === "chat" ? "dashboard" : "chat"), true);
}
}
});

test("missing entries or empty URLs keep the poster fallback", () => {
assert.equal(hasProductVideo({}, "chat"), false);
for (const theme of ["light", "dark"]) {
const manifest = structuredClone(fixture);
delete manifest[`chat-${theme}`];
assert.equal(hasProductVideo(manifest, "chat"), false);
for (const invalid of ["", null, 42]) {
const manifest = structuredClone(fixture);
manifest[`chat-${theme}`].mp4 = invalid;
assert.equal(hasProductVideo(manifest, "chat"), false);
}
}
});
73 changes: 73 additions & 0 deletions site/scripts/landing-recordings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Landing recordings

Record the chat and dashboard slots from an OpenTelemetry Demo instance with
chat enabled.

Expected assets (all at 1280 × 800):

- `site/src/assets/landing/chat-{light,dark}.{webm,mp4,png}`
- `site/src/assets/landing/dashboard-{light,dark}.{webm,mp4,png}`

Encoded videos stay local and are ignored by Git and Docker; PNG posters stay
in the repository so Astro can optimize them. Published videos live in the
Cloudflare R2 bucket `fanout-assets`, served at `https://assets.fanout.run/`.

Each slot stays poster-only until both themes have both video formats in
`site/src/data/landing-media.json`. An absent manifest also shows posters. The
component follows the site theme, pauses off screen and in hidden tabs, and
shows only the poster when reduced motion is enabled. Its `spedUp` prop marks
recordings with shortened waits in the caption.

Set `FANOUT_LANDING_RECORDINGS=1`, `FANOUT_LANDING_BASE_URL` to the existing
instance URL, and `FANOUT_LANDING_SESSION_COOKIE` to a `name=value` session cookie
in the process environment. Run from `ui/host`:

```sh
bun run e2e landing-recordings.spec.ts --project=1440-light --project=1440-dark
```

Recordings use a 1280 × 800 viewport and raw video at the same size; Playwright
video captures CSS pixels, so a higher device scale only pads the frame. This only uses the external instance. It types the brief's prompts, waits for
the real run to finish, and dwells for three seconds. The dashboard clip also
opens the dashboard from its successful `create_dashboard` result and waits
for the saved panels to render. It creates real chats and dashboards; no data
is mocked or intercepted.

Raw WebM files and matching JSON timelines go to
`ui/host/test-results/landing-recordings/`, excluded from Git and Docker inputs.
Keep a copy before another Playwright run clears `test-results`. Timelines use
seconds from page creation, with server event timestamps anchored to receipt of
the run's response headers to avoid server clock skew. They list model-thinking
and tool-call intervals from the unmodified AG-UI stream and contain no session
credentials or tool result payloads. Raw recordings can contain instance data.

From the repository root, with ffmpeg and ffprobe installed:

```sh
bash site/scripts/encode-clips.sh
# Or use a saved raw output directory:
bash site/scripts/encode-clips.sh /path/to/landing-recordings
```

It encodes every recording present in the input directory. An optional second
directory argument writes encoded assets elsewhere for review.

The encoder merges overlapping waits, compresses each wait longer than 0.6 s
to 0.6 s, preserves typing and the final dwell, and writes VP9 WebM and H.264
MP4 at 1280 × 800 and 30 fps with a two-pass target of about 4 MB per file.
It extracts each PNG poster from the final encoded frame. Review the clips and
posters, then upload from the repository root with Wrangler logged in to the
account that owns `fanout-assets`:

```sh
bash site/scripts/upload-clips.sh
# Or upload an encoded directory used for review:
bash site/scripts/upload-clips.sh /path/to/encoded-clips
```

The uploader writes content-addressed immutable keys, skips unchanged clips
already listed in the manifest, and preserves URLs for clips absent from the
input directory. It never deletes old objects because published pages may still
reference them. After uploading, commit `site/src/data/landing-media.json` and
the PNG posters. If encoding elsewhere, copy the reviewed PNGs into
`site/src/assets/landing/` first. Never commit WebM or MP4 files.
82 changes: 82 additions & 0 deletions site/scripts/landing-recordings.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { recordingTimeline } from "../../ui/host/e2e/landing-recording-support.ts";
import { clipSegments, clipFilter } from "./clip-timeline.mjs";

const stream = events => events.map(event => `data: ${JSON.stringify(event)}\n\n`).join("");
const event = (type, at, data = {}) => ({ type, timestamp: 1_000_000 + at * 1000, ...data });

test("recording times survive server clock skew and preserve visible reasoning and answer text", () => {
const recorded = recordingTimeline(stream([
event("RUN_STARTED", 0), event("REASONING_MESSAGE_START", 2), event("REASONING_MESSAGE_CONTENT", 3),
event("REASONING_MESSAGE_END", 4), event("TOOL_CALL_START", 6, { toolCallId: "q", toolCallName: "query_telemetry" }),
event("TOOL_CALL_END", 6.1, { toolCallId: "q" }), // Arguments ended; the tool is still running.
event("TOOL_CALL_RESULT", 9, { toolCallId: "q", content: "{}" }),
event("TEXT_MESSAGE_START", 12), event("TEXT_MESSAGE_CONTENT", 13), event("RUN_FINISHED", 14),
]), 10);
assert.deepEqual(recorded.waits, [
{ kind: "model_thinking", start: 10, end: 12 },
{ kind: "model_thinking", start: 14, end: 16 },
{ kind: "tool_call", start: 16, end: 19, tool: "query_telemetry" },
{ kind: "model_thinking", start: 19, end: 22 },
]);
});

test("concurrent tools remain distinct and only a successful create receipt identifies the new dashboard", () => {
const created = { dashboard: { id: "new-dashboard" }, receipt: { version: 1 } };
for (const result of [created, { ...created, error: "failed" }, { ...created, isError: true }, { dashboard: created.dashboard }]) {
const timeline = recordingTimeline(stream([
event("RUN_STARTED", 0),
event("TOOL_CALL_START", 1, { toolCallId: "a", toolCallName: "create_dashboard" }),
event("TOOL_CALL_START", 2, { toolCallId: "b", toolCallName: "search_logs" }),
event("TOOL_CALL_RESULT", 3, { toolCallId: "a", content: JSON.stringify(result) }),
event("TOOL_CALL_RESULT", 4, { toolCallId: "b", content: "{}" }),
event("TEXT_MESSAGE_START", 5), event("RUN_FINISHED", 6),
]).replaceAll("\n", "\r\n"), 0);
assert.equal(timeline.dashboardId, result === created ? "new-dashboard" : undefined);
assert.deepEqual(timeline.waits.filter(wait => wait.kind === "model_thinking"), [
{ kind: "model_thinking", start: 0, end: 1 }, { kind: "model_thinking", start: 4, end: 5 },
]);
assert.equal(timeline.waits.filter(wait => wait.kind === "tool_call").length, 2);
}
});

test("failed, truncated, untimed or unresolved runs cannot become successful recordings", () => {
const start = event("RUN_STARTED", 0), end = event("RUN_FINISHED", 10);
for (const events of [[], [start], [start, event("RUN_ERROR", 1), end],
[start, { type: "TEXT_MESSAGE_START" }, end],
[start, event("TOOL_CALL_START", 1, { toolCallId: "a", toolCallName: "query_telemetry" }), end],
[start, event("TOOL_CALL_RESULT", 1, { toolCallId: "a" }), end]]) {
assert.throws(() => recordingTimeline(stream(events), 0));
}
});

test("encoding merges overlapping waits, keeps short waits and preserves typing and dwell", () => {
const segments = clipSegments([{ start: 5, end: 12 }, { start: 4, end: 8 }, { start: 15, end: 15.2 }], 20);
assert.deepEqual(segments, [
{ start: 0, end: 4, seconds: 4 }, { start: 4, end: 12, seconds: 0.6 },
{ start: 12, end: 15, seconds: 3 }, { start: 15, end: 15.2, seconds: 15.2 - 15 },
{ start: 15.2, end: 20, seconds: 20 - 15.2 },
]);
const filter = clipFilter(segments);
assert.match(filter, /trim=start=4:end=12,setpts=\(PTS-STARTPTS\)\*0.075\[v1\]/);
assert.match(filter, /concat=n=5:v=1:a=0,scale=1280:800,fps=30,format=yuv420p\[out\]/);
assert.deepEqual(clipSegments([], 3), [{ start: 0, end: 3, seconds: 3 }]);
});

test("invalid trim times fail before invoking ffmpeg", () => {
for (const waits of [[{ start: -1, end: 2 }], [{ start: 3, end: 2 }], [{ start: 0, end: Infinity }], [{ start: 1, end: 11 }], null]) {
assert.throws(() => clipSegments(waits, 10));
}
assert.throws(() => clipSegments([], 0));
});

test("encoding cuts frames before the clip start", () => {
const segments = clipSegments([{ start: 1, end: 3 }, { start: 5, end: 8 }], 12, 4);
assert.deepEqual(segments, [
{ start: 4, end: 5, seconds: 1 },
{ start: 5, end: 8, seconds: 0.6 },
{ start: 8, end: 12, seconds: 4 },
]);
assert.throws(() => clipSegments([], 12, 12), /Clip start must be within the raw video/);
});
Loading
Loading