Trace View

View as Markdown

Where a run spent its time: each step in a tree beside a bar on one time axis, with the chosen step's tokens, attributes, input and output.

7.42 s in all9 steps6,658 tokens2 errors
  • answer_ticket #4821, Agent, 7.42 s, starts at 0 ms
  • plan, Model, 1.18 s, starts at 40 ms
  • get_jobs, Tool, 2.31 s, starts at 1.26 s, failed
  • SELECT export_jobs, Database, 2.01 s, starts at 1.29 s, failed
  • SELECT export_jobs (retry), Database, 220 ms, starts at 3.33 s
  • search_docs, Search, 640 ms, starts at 1.27 s
  • POST /v1/search, HTTP, 560 ms, starts at 1.3 s
  • draft_reply, Model, 3.72 s, starts at 3.6 s
  • post_internal_note, Tool, 60 ms, starts at 7.34 s

When to use

Where a run spent its time: each step in a tree beside a bar on one time axis, with the chosen step's tokens, attributes, input and output. Use Run Summary instead when people need the run's outcome and cost, not where its time went.

Usage

import { type Span, TraceView } from "./ui/uicontext/components/TraceView.ts"
export const RunTrace = <M>(h: Html.H<M>, spans: ReadonlyArray<Span>) =>	TraceView(h, { props: { label: "Run trace", spans } })

Examples

A slow request, opened one level

depth sets how many levels start open. Open load board to see twelve queries, one after another.

1.84 s in all16 steps
  • GET /projects/ENG/board, HTTP, 1.84 s, starts at 0 ms
  • check session, Database, 12 ms, starts at 4 ms
  • render, Tool, 190 ms, starts at 1.64 s

API reference

Props

TraceView props
NameTypeDescription
labelrequiredstringWhat the trace is, for screen readers: "Run 4821".
spansrequiredSpan[]—
depthnumberHow many levels start open; all by default.
localestringFor the numbers; the browser's by default.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/trace-view

Source