Percentiles
How fast something answers for most people and for the unlucky few: the median (p50) and the slow tail (p95, p99) over time, on one axis.
import { Percentiles, ChartSkeleton } from '@sypnia/ui/react'
Response time over a week
Response time of /orders
Milliseconds, last 7 days
- p50
- p95
- p99
View as table
| Day | p50 | p95 | p99 |
|---|---|---|---|
| Nov 11 | 118 ms | 410 ms | 880 ms |
| Nov 12 | 122 ms | 430 ms | 940 ms |
| Nov 13 | 125 ms | 520 ms | 1.6 sec |
| Nov 14 | 119 ms | 405 ms | 860 ms |
| Nov 15 | 131 ms | 610 ms | 2.1 sec |
| Nov 16 | 128 ms | 480 ms | 1.1 sec |
| Nov 17 | 124 ms | 452 ms | 990 ms |
Code
import { Percentiles } from '@sypnia/ui/react';
// The median and the slow tail on one axis. The band is the spread between p50 and p99.
const days = ['Nov 11', 'Nov 12', 'Nov 13', 'Nov 14', 'Nov 15', 'Nov 16', 'Nov 17'];
export default function Latency() {
return (
<Percentiles title="Response time of /orders" subtitle="Milliseconds, last 7 days" xLabel="Day" x={days}
p50={[118, 122, 125, 119, 131, 128, 124]} p95={[410, 430, 520, 405, 610, 480, 452]} p99={[880, 940, 1600, 860, 2100, 1050, 990]} />
);
} Skeleton
Code
import { ChartSkeleton } from '@sypnia/ui/react';
// The chart before its numbers come: the axes and a legend for three lines.
export default function Skeleton() {
return <ChartSkeleton legend={3} />;
} When to use it
Use it when
- Response times of an endpoint, a query, a page.
- Watch the p99: it is what the slowest one in a hundred lives through.
Do not use it when
- Averages: they hide the slow tail.
- Values that are not times or sizes.
For everyone
- Each line is named at its end and in the legend; the tooltip reads every percentile at once.
- «View as table» has every value.
Props
| Percentiles | Type | Default |
|---|---|---|
p50required | (number | null)[] | |
titlerequired | ReactNode | |
xrequired | string[] | |
empty | ReactNode | |
error | ReactNode | |
formatValueDefaults to milliseconds, written the person's way: 840 ms, 1.2 s. | Fmt | |
height | number | |
loading | boolean | |
p90 | (number | null)[] | |
p95 | (number | null)[] | |
p99 | (number | null)[] | |
subtitleWhat is plotted and in what unit: «Requests per minute, last 24 hours». | ReactNode | |
xLabel | string |
| ChartSkeleton | Type | Default |
|---|---|---|
height | number | 240 |
legendHow many series the legend will list. | number | 0 |
tableWhether the chart will offer «View as table» under the plot (every LineChart, AreaChart and BarChart does). | boolean | true |