Waterfall
The spans of a trace on one time line: what ran, when it started, how long it took and what ran inside it. A failing span is marked in words and colour.
import { Waterfall } from '@sypnia/ui/react'
A request and what it did
GET /orders/1042
Trace 7f3a9c · 412 ms
- GET /orders/1042412 ms
- auth.verify22 ms
- db.query orders140 ms
- db.query items180 ms
- retry items120 ms
- render json48 ms
View as table
| Starts | Takes | |
|---|---|---|
| GET /orders/1042 | 0 ms | 412 ms |
| auth.verify | 4 ms | 22 ms |
| db.query orders | 30 ms | 140 ms |
| db.query items | 175 ms | 180 ms |
| retry items | 210 ms | 120 ms |
| render json | 360 ms | 48 ms |
Code
import { Waterfall } from '@sypnia/ui/react';
// One request and everything it did. The failing query is marked in words and colour.
export default function Trace() {
return <Waterfall title="GET /orders/1042" subtitle="Trace 7f3a9c · 412 ms" spans={[
{ id: '1', label: 'GET /orders/1042', start: 0, duration: 412 },
{ id: '2', label: 'auth.verify', start: 4, duration: 22, depth: 1 },
{ id: '3', label: 'db.query orders', start: 30, duration: 140, depth: 1 },
{ id: '4', label: 'db.query items', start: 175, duration: 180, depth: 1, failed: true },
{ id: '5', label: 'retry items', start: 210, duration: 120, depth: 2 },
{ id: '6', label: 'render json', start: 360, duration: 48, depth: 1 },
]} />;
} When to use it
Use it when
- Traces of a request, steps of a job.
Do not use it when
- Totals that add and subtract: that is a different chart.
For everyone
- Each span is named with when it started, how long it took, and whether it failed.
- Nesting is shown by indentation, not by colour alone.
Props
| Waterfall | Type | Default |
|---|---|---|
spansrequired | Span[] | |
titlerequired | ReactNode | |
empty | ReactNode | |
error | ReactNode | |
formatDuration | Fmt | |
height | number | |
loading | boolean | |
subtitle | ReactNode |