Visual Setups, Views & Theming
Adapt <trace-visualizer> to any embedding context — from a dense 280 px PR-check widget
or obsidian incident-command console to a spacious 4-view observability workspace — using declarative
<trace-view> children, geometry attributes, and --l2t-* CSS design tokens.
1Visual Setup Archetypes
Switch between four production-ready visual & data-complexity configurations below. Notice how row density, theme tokens, span-kind palettes, tab composition, and dataset shape work together — and copy the exact markup for any setup.
2Waterfall Geometry, Sizing & Keyboard Navigation
Tune row density with span-height and span-padding, adjust the label column with
gutter-width, size the inspector with detail-panel-width, or enable plain-wheel zooming with wheel-zoom.
Waterfall Keyboard & Pointer Controls
| Input | Action |
|---|---|
| ↑ / ↓ | Select previous or next visible span row |
| Shift + ← / → | Collapse or expand the selected span's subtree |
| ← / → | Pan timeline camera left or right |
| + / - / 0 (Home) | Zoom in, zoom out, or reset zoom to 100% |
| PageUp / PageDown | Scroll vertically by one viewport page |
| Enter / Space | Move keyboard focus into the open detail panel for the selected span |
| Escape | Return focus from detail panel/filter to timeline, or clear selection and close detail panel |
| Ctrl/⌘ + F | Focus the first filter control when a filter bar is configured |
| Wheel / Ctrl+Wheel / Drag | Wheel scrolls rows; Ctrl/⌘+Wheel (or pinch) zooms at cursor; drag pans; double-click resets zoom |
3Flame Graph & Service Dependency Map
Flame Graph (type="flame") folds repeated call paths — such as the 5 vector-shard probes and 3 Postgres chunk fetches
in our AI Hybrid RAG trace — into cumulative hotspot boxes. Service Map (type="service") renders a
directed topology of all 9 microservices and their inferred external peers (Qdrant, Elasticsearch, Redis, Postgres, Kafka) with live latency and error rates.
<trace-visualizer data-url="./data/ai-search-trace.json" show-legend>
<trace-view type="flame" active></trace-view>
<trace-view type="service"></trace-view>
<trace-view type="waterfall"></trace-view>
</trace-visualizer>
4Sequence Diagram & Per-View Options
<trace-view type="sequence"> draws causal participant lifelines, synchronous request/return arrows,
asynchronous Kafka pub/sub hops, and automatic loop folding. Below, the AI Hybrid RAG trace runs 5 consecutive
VectorSearch/QueryShard calls (folded into loop ×5 when fold="3") and fails over after a 429 rate-limit error.
5Trace Statistics & Per-View Options
<trace-view type="stats"> aggregates spans by service-operation, service,
operation, kind, or switches to flat none (Spans) mode — ranking N+1 hotspots,
error rates, exclusive self-time, recursion-safe totals, and latency percentiles (Min, Avg, P50, P95, Max).
Click any group chevron (or press →) to inspect individual member spans inline.
6Service Lanes & Concurrency
<trace-view type="lanes"> draws one swimlane per service on a shared time axis, so you can see
who was busy when and how much ran in parallel. Each lane is split into levels: concurrent spans are packed
into as few rows as possible, and a child always sits below its same-service parent. Services' external dependencies
appear as ghost peer lanes (italic name, hatched or outlined bars): calls seen from the caller to an
uninstrumented database, cache, broker, or host. When thousands of spans fall inside a few pixels, they collapse into
merged hatched bars whose tooltip shows the count; zoom in to split them again.
A lane taller than max-rows is capped with a +N rows overflow row (click it to show every level).
A collapsed lane becomes a one-row in-flight concurrency area chart with error ticks; with a filter active it counts
only matching requests. The gutter reports each lane's spans · busy % · peak concurrency · errors, and
hovering an empty stretch of a lane (between spans, or before its first and after its last) shows its idle time. Selecting a span fades everything outside its request's causal tree.
image-worker pool, so that lane stays pinned at 8
concurrent spans (saturation), preceded by a ~140 ms idle gap while job-scheduler waits on an uninstrumented feature-flag call.
Hover the empty space at the start of the image-worker lane to read the idle time, double-click it to zoom to it, collapse image-worker to see its concurrency curve, then switch on
Errors Only to count only the 3 failing tasks.
Lanes Keyboard & Pointer Controls
| Input | Action |
|---|---|
| ← / → | Select the previous or next span on the same track (level row) |
| ↑ / ↓ | Select the parent span, or the first child |
| Enter / Space | Collapse or expand the lane of the selected span |
| E / G | Expand all lanes / collapse all lanes (also the Expand all and Collapse all toolbar buttons) |
| + / - / 0 (Home) | Zoom in, zoom out, or reset zoom to 100% |
| F | Zoom to the selected span |
| PageUp / PageDown | Scroll the lanes vertically by one viewport page |
| Escape | Clear the selection and close the detail panel |
| Click | Select a span or merged run (Ctrl/⌘/Shift+click adds to the selection); click a lane header to collapse or expand the lane; click +N rows to show all levels |
| Double-click | Zoom to a span, a merged run, or an idle gap |
| Ctrl/⌘+Wheel / Drag | Ctrl/⌘+wheel (or pinch) zooms at the cursor; drag pans the timeline; hover an empty gap in a lane to see its idle time |
Lanes vs. Waterfall vs. Flame Graph
| View | Best for |
|---|---|
| Lanes | Concurrency and saturation per service: worker pools, fan-out, idle gaps, retry storms, and who was busy at a given moment. Handles tens of thousands of spans through merging. |
| Waterfall | One request's causal tree in call order: exact parent/child nesting, per-span timing, and log events. |
| Flame Graph | Where the cumulative time went: identical call paths folded into hotspot boxes, with no time axis. |
7Themes, Span-Kind Colors & CSS Tokens
By default, <trace-visualizer> follows prefers-color-scheme. Pin it with
theme="light" or theme="dark", override span-kind colors via kind-colors,
or customize any surface, grid, border, accent, or font using CSS custom properties (--l2t-color-* and --l2t-font-*).
CSS Custom Property Reference
| Custom Property | Light Default | Dark Default | Usage |
|---|---|---|---|
--l2t-color-background | #ffffff | #1b1d23 | Primary stage & viewport background |
--l2t-color-surface | #f6f7f9 | #23262e | Toolbar, tabs, filter bar, and detail panel surface |
--l2t-color-border / --l2t-color-grid | #dddddd / #ececec | #3a3e49 / #2c3039 | Hairline dividers and timeline ruler gridlines |
--l2t-color-text / --l2t-color-textMuted | #333333 / #666666 | #e4e6eb / #9aa0ac | Primary labels and secondary timestamps/metadata |
--l2t-color-accent | #007bff | #4da3ff | Active tab indicator, focus ring, and primary interactive controls |
--l2t-color-error | #c62828 | #ff6b6b | Failed span markers, error badges, and error status messages |
--l2t-color-kindServer … kindConsumer | Set automatically or via kind-colors | kindUnspecified, kindInternal, kindServer, kindClient, kindProducer, kindConsumer | |
--l2t-font-sans / --l2t-font-mono | System UI / Monospace | UI chrome font stack and numeric/code font stack | |
8Extending with registerView()
Register custom views implementing TraceView via registerView({ id, label, capabilities, create })
and declare them alongside built-in views as <trace-view type="your-id">. Below is a live
Slowest Spans leaderboard over the 43-span AI Hybrid RAG trace sharing filter and selection state with Waterfall and Flame Graph.
import { registerView, formatDuration, spanKindName } from 'log2trace-ui';
// Register before <trace-visualizer> upgrades (or set viz.view = 'hot-spans'
// after re-inserting its <trace-view> carrier if the element was already parsed).
registerView({
id: 'hot-spans',
label: 'Slowest Spans',
capabilities: { legend: false },
create() {
let root = null;
let ctx = null;
function render() {
if (!root || !ctx) return;
const { data, selection, matched } = ctx.store.state;
const rows = [...data.index.ordered]
.filter((s) => matched === null || matched.has(s.spanId))
.sort((a, b) => b.durationMs - a.durationMs);
// Render rows and write selection back via:
// ctx.store.setSelection([span.spanId], { origin: ctx.origin, primary: span.spanId });
}
return {
mount(surface, viewCtx) {
ctx = viewCtx;
root = document.createElement('div');
surface.appendChild(root);
render();
},
update() { render(); },
optionsChanged() {},
themeChanged() { render(); },
commands: () => [],
getState: () => null,
setState() {},
unmount() { root?.remove(); root = null; ctx = null; },
};
},
});