Agent Skillslangfuse/langfuse › seed-test-data

seed-test-data

GitHub

用于在本地环境中为 Langfuse 生成确定性测试数据,支持 ClickHouse 和 Postgres。提供复杂追踪、长会话及性能测试场景,并包含环境诊断工具。

.agents/skills/seed-test-data/SKILL.md langfuse/langfuse

Trigger Scenarios

需要生成本地 Langfuse 测试数据 进行前端渲染或性能测试 构建复杂追踪或异步父节点场景

Install

npx skills add langfuse/langfuse --skill seed-test-data -g -y
More Options

Non-standard path

npx skills add https://github.com/langfuse/langfuse/tree/main/.agents/skills/seed-test-data -g -y

Use without installing

npx skills use langfuse/langfuse@seed-test-data

指定 Agent (Claude Code)

npx skills add langfuse/langfuse --skill seed-test-data -a claude-code -g -y

安装 repo 全部 skill

npx skills add langfuse/langfuse --all -g -y

预览 repo 内 skill

npx skills add langfuse/langfuse --list

SKILL.md

Frontmatter
{
    "name": "seed-test-data",
    "description": "Seed reproducible local Langfuse data in ClickHouse and Postgres. Use for\ncomplex traces, long sessions, v3\/v4 events, bulk list data, or frontend\nrendering and performance tests; never use ad hoc scripts or raw inserts."
}

Seed Test Data

One-shot deterministic test data for local Langfuse. The CLI handles env loading, preflight checks, ClickHouse/Postgres writes, readback verification, and prints UI deep links plus a machine-readable JSON summary (last stdout line).

If anything fails, run doctor first

pnpm run seed -- doctor

Prints PASS/WARN/FAIL per dependency (Postgres, migrations, project, ClickHouse, v4 dev tables, Redis, MinIO, web app) with the exact fix command for every failure. Do not debug Docker/ClickHouse manually before running this.

Need → command

I need... Command
A very complex observation tree (v3) pnpm run seed -- trace-tree --observations 5000 --depth 12 --breadth 500
The same tree readable in the v4 events UI add --v4 (writes events_full; events_core fills via MV)
Async parents whose subtree outlives their own span (subtree wall-clock duration badge) add --async-parents to trace-tree (root + hub end immediately while children keep running)
A realistic agent flow over a timeline (graph view + scrubbable timeline) pnpm run seed -- agent-timeline --turns 6 --v4 (LangGraph refine loop planner→retriever→generator→critic→loop, staggered in time; add --timing-only for the pure timing fallback)
A trace that is large as a GRAPH (many distinct node names + connections, the trace-graph layout stress) pnpm run seed -- agent-graph --v4 (~1,350 distinct connections from 350 observations; --nodes 120 --steps 100 --parallel 8 crosses the layout ceiling, --nodes 80 --steps 30 --parallel 4 is small-but-dense)
A dozen SMALL traces, each a different timeline shape (the everyday case, not a stress test) pnpm run seed -- timeline-shapes --v4 (12 hand-timed traces of 4-25 observations: rag answer, streamed chat with a TTFT split, 8-way fan-out, retry backoff with widening gaps, a 13-minute wait on a human, one slow tool dwarfing everything, an error cascade with failover, in-flight spans with no end time, zero-duration checkpoints, a ten-level ladder, 24 flat siblings, a three-turn agent loop with think time; --shape <slug> for one)
A multi-HOUR agent run (wall clock dominated by waiting, as production ones are) pnpm run seed -- agent-timeline --turns 120 --turn-gap-ms 60000 --v4 (~2.5h; the gap is jittered up to 2x, so the work lands at a few percent of the trace instead of packing every span into a few seconds)
A demo-grade, real-looking agent trace (videos, screenshots, docs) pnpm run seed -- support-agent --v4 --id-prefix <hex> (one fixed, fully handcrafted support-copilot refund run: guardrails, parallel context fan-out, 3-turn ReAct loop with real payloads/costs; deterministic — reseed with a FRESH prefix for a clean take; the prefix is the trace id, so a hex prefix reads like production)
A plain trace with no agentic types (collapsed-by-default graph panel) add --plain to trace-tree (SPAN/GENERATION/EVENT only)
A trace with MORE observations than the detail view loads (v4 caps the tree at 10k, startTime ASC — the chronological tail is missing) pnpm run seed -- trace-tree --observations 12000 --stride-ms 10 --v4 (--stride-ms starts each observation index × N ms in, so start times are unique and strictly increasing: observation index < 10000 loads, -obs-10000 and up fall past the cap. Without it thousands of rows share one millisecond and the boundary is arbitrary. Re-runs that CHANGE timing flags need a fresh --id-prefix: start_time is an events ORDER BY key, so both versions persist in the same trace)
An extremely DEEP single-chain trace (tree depth = observation count; layout stress) pnpm run seed -- deep-chain --v4 (1401 sequential generations, each the sole child of the previous — the mis-parented-instrumentation shape from LFE-10959 that collapses tree/timeline layouts; --observations N to change depth)
A super tough session (v3 legacy session view) pnpm run seed -- long-session --traces 300 --observations-per-trace 8
Diverse v4 session shapes (chat / coding-agent / mixed / media) for the session-detail view pnpm run seed -- session-shapes --shape all (the agent shape has I/O on AGENT/TOOL with no GENERATION — pre-LFE-10520 the "first generation" default rendered empty cards for it; the current "All observations with I/O" default renders it correctly; v4 on by default)
Session messages carrying Langfuse media references (inline image, several refs in one message, bare refs in a content array, link-only payload) pnpm run seed -- session-shapes --shape media — uploads the image/audio/pdf fixtures to MinIO and links them to the observation, so the inline chip and the "Media" strip both resolve (LFE-14815, LFE-9577)
Many traces for list/filter performance pnpm run seed -- many-traces --count 100000 --days 14
Long-window v4 traffic with cost/latency/token OUTLIERS (outlier chart strip, LFE-14451) pnpm run seed -- outlier-traffic --days 90 (diurnal base load + deterministic spikes + hour-long ×8-latency incidents; root AGENT + GENERATION carrying cost + TOOL per trace; v4 on by default)
Scores with spaces in the name (filter/grammar testing) pnpm run seed -- scored-traces --traces 24 --v4
Custom model definitions reachable from a trace (price editor entry points) pnpm run seed -- custom-models --v4 (a tiered model with a condition-gated second tier and one usage type priced at 0, a single-tier model, and a generation whose model matches no definition so its badge opens the create dialog)
Lots of scores on every node (dense score badges, tree-row overflow testing) add --scores-per-node 12 to trace-tree (N distinct scores per observation; try --depth 2 --breadth 44 for many tall sibling rows)
Extra trace tags, incl. mixed case/accents (tag filter ordering) add --tags "Zebra,apple,Ärger" to trace-tree (comma-separated, appended to the scenario's own tags)
Varied human-annotation queues (annotate UI / keyboard testing) pnpm run seed -- annotation-queue --core-items 12 (creates a "core types" queue covering every score-field render path + an "edge cases" queue with archived/stale/partial scores and observation/session/deleted/completed items)
Huge/malformed/unicode payloads pnpm run seed -- trace-tree --payload-bytes 1000000 --payload-style malformed (styles: json, text, malformed, unicode, bignum, base64)
Big integers beyond 2^53-1 (number-precision testing) pnpm run seed -- trace-tree --observations 1 --payload-style bignum
Huge base64 data-URI in ChatML IO (multimodal crash shape, LFE-10152) pnpm run seed -- trace-tree --observations 30 --payload-bytes 20000000 --payload-style base64 --v4 (one unbroken multi-MB base64 token in trace + root-observation IO; max 50 MB)
See all scenarios and flags pnpm run seed -- list --json
Predict without writing add --dry-run

Contract

  • Last stdout line is a JSON summary: traceIds, sessionIds, counts, verified (ClickHouse readback), links (UI deep links). Use --json to suppress progress logs. Non-zero exit = data did not land; the error includes a fix: line.
  • Deterministic: same --seed (default 42) and flags → same ids (ids never contain dates), with timestamps anchored to the current UTC day. Re-running within the same day overwrites in place; a later-day re-run updates the same ids with re-anchored timestamps (the previous day's rows persist under their old dates until then). Independent copies come only from --id-prefix.
  • Default project is the seeded 7a88fb47-b4e2-43b8-a06c-a5ce950dc53a (login demo@langfuse.com / password); override with --project.
  • Open the printed links in the browser to verify visually. The v4 events-backed UI is the per-user "Fast (Preview)" sidebar toggle, or LANGFUSE_MIGRATION_V4_WRITE_MODE=events_only server-side.

Extending

Add a scenario in packages/shared/scripts/seeder/scenarios/: a plain function using the deterministic Rng (never Math.random), register it in scenarios/index.ts, and update the table in packages/shared/scripts/seeder/AGENTS.md and this skill. Scenario names, flags, and JSON keys are additive-only contracts. Design rationale: packages/shared/scripts/seeder/README.md.

Version History

  • f7e3c26 Current 2026-08-20 17:47

Same Skill Collection

.agents/skills/add-model-price/SKILL.md
.agents/skills/agent-setup-maintenance/SKILL.md
.agents/skills/analyze-cloud-costs/SKILL.md
.agents/skills/backend-dev-guidelines/SKILL.md
.agents/skills/changelog-writing/SKILL.md
.agents/skills/clickhouse-best-practices/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/create-repo-agent/SKILL.md
.agents/skills/cursor-agents-workflow/SKILL.md
.agents/skills/datadog-query-recipes/SKILL.md
.agents/skills/debug-issue-with-datadog/SKILL.md
.agents/skills/frontend-browser-review/SKILL.md
.agents/skills/frontend-large-feature-architecture/SKILL.md
.agents/skills/git-workflow/SKILL.md
.agents/skills/housekeeping/SKILL.md
.agents/skills/incident-alert-tickets/SKILL.md
.agents/skills/infra-scaling/SKILL.md
.agents/skills/langfuse-codebase-navigator/SKILL.md
.agents/skills/langfuse-previews/SKILL.md
.agents/skills/linear-bug-triage/SKILL.md
.agents/skills/pnpm-upgrade-package/SKILL.md
.agents/skills/posthog-instrumentation/SKILL.md
.agents/skills/react-component-cleaner/SKILL.md
.agents/skills/react-component-guidelines/SKILL.md
.agents/skills/refactor-react-effects/SKILL.md
.agents/skills/security-review/SKILL.md
.agents/skills/sentry-instrumentation/SKILL.md
.agents/skills/skill-creator/SKILL.md
.agents/skills/turborepo/SKILL.md
.agents/skills/weekly-production-review/SKILL.md
web/.agents/skills/vercel-composition-patterns/SKILL.md
web/.agents/skills/vercel-react-best-practices/SKILL.md
.agents/skills/storybook/SKILL.md

Metadata

Files
0
Version
f7e3c26
Hash
a30b5b42
Indexed
2026-08-20 17:47

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-27 19:29
浙ICP备14020137号-1 $Carte des visiteurs$