Trace Waterfall
Show the spans of a distributed trace as a tree, each with a duration bar on one shared time axis.
c2-trace-waterfall draws one distributed trace the way Sentry, Datadog APM and Grafana Tempo do: the spans as a
tree on the left, and on the right a bar per span, offset by when it started and as long as it lasted, all on one time
axis. Bars are coloured by service (one series colour per service, in order of appearance) and a span with
status: "error" is drawn in the error colour with a marker before its name.
Hand it the spans through spans, as a property or a JSON attribute. Each span needs an id, a name, a start
and a duration or an end; parentId hangs it below another span. Times may be absolute or relative, since the
axis starts at the earliest span, and time-unit says what they are in: ns reads OpenTelemetry’s
startTimeUnixNano directly, even as a numeric string. A span whose parent is missing is drawn as a root, so a
partial trace still renders.
Clicking a span selects it and fires selection-change with the span as you gave it, which is how an app opens its
details next to the waterfall. search highlights the spans whose name or service contains the text, dims the rest
and opens the spans above each match; pair it with c2-search-field. The tree is keyboard-driven: arrows walk, open
and close spans and Enter selects.
Import
import '@c2n/components/trace-waterfall'