POST /v1/traces/stats gives the numbers of the viewer’s summary strip for the traces that match a trace query. It reads at most the newest 100,000 matching traces. Right: read.
Body
The conditions of
/v1/traces/find: filter, root, anySpan, anyScore. Its limit, cursor, sort and previewChars are not used.Answer
The number of matching traces when
complete is true. Else null: counting the rest would be the work that the cap avoids.The median duration (end minus start of the trace), nearest rank over the ended traces.
durationP95Ms is the 95th percentile. null when no trace has ended.The width of a bucket: the smallest of 1 s, 5 s, 15 s, 30 s, 1, 2, 5, 10, 15, 30 min, 1, 2, 3, 6, 12 h, 1, 2, 7, 14, 30, 90 days, or whole years, that gives at most
bars buckets. Buckets are aligned to the Unix epoch.The end of the window:
filter.to of the query. With a from and no to, it is now (the server’s clock). With neither, it is just after the newest read trace.Trace starts per bucket: every bucket from the one of
from to the one of to - 1, the empty ones too, oldest first. No window (no trace and no from): no buckets.How the server keeps the work small
How the server keeps the work small
The server reads the traces newest first, in time windows that double, from one minute back from the newest trace of the store (or from the query’s
to when that is earlier). In each window, it gives every span condition the window’s start as its lowest start: no answer changes. The engine’s joins and counts cover only the windows read.With more matches than the cap, the server reads the time from the newest trace back to at most twice the time that holds the newest 100,000 matches, whatever the server’s clock. Older matches cost nothing.Find traces
The query that this route sums.
Viewer
The web viewer that shows these numbers.