demo D213
Fleet and network in React
Address, data-size and rate types, latency long-tailed so p99 bites
type: ipv4 · bytes · bitrate
This is a fleet and network sheet with address, data-size and rate types, and latency that is long-tailed so the p99 really bites. It shows infrastructure metrics with the right types and the tail statistic that matters for reliability.
This is the React version. The grid mounts through the createLatticeGrid adapter, which takes its configuration as ordinary props and hands back the live grid through a ref. The grid below is the same one every other tab runs.
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/lattice-grid.min.css">
<div id="grid"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/modules/react.esm.min.js';
const LatticeGrid = createLatticeGrid({ React, createGrid });
const columns = [
{ field: 'host', title: 'Host', layout: { pin: 'start', width: 140 } },
{ field: 'rack', title: 'Rack', filter: { type: 'set' } },
// ipv4 sorts in address order, so .9 comes before .10. Latency is
// long-tailed, so p99 reads far from the median.
{ field: 'address', title: 'Address', type: 'ipv4' },
{ field: 'disk', title: 'Disk', type: 'bytes', total: 'sum' },
{ field: 'link', title: 'Link', type: 'bitrate', total: 'sum' },
{ field: 'latency', title: 'Latency', type: 'milliseconds', total: 'p99' },
{ field: 'cpu', title: 'CPU', type: 'percentRate', total: 'avg' },
{ field: 'draw', title: 'Power', type: 'kilowatts', total: 'sum' },
];
const formatting = {
latency: [
{ id: 'l-top', when: { op: 'topPercent', value: 5 }, style: { background: '#fbeceb' } },
{ id: 'l-med', when: { op: 'aboveMedian' }, style: { color: '#a4262c' } },
],
};
const rows = [/* hosts: host, rack, address, disk, link, latency, cpu, draw */];
function App() {
return (
<LatticeGrid
rowKey="id"
columnDefaults={{ filter: true }}
toolPanel={{ side: 'left', panels: ['columns', 'filters', 'statistics'] }}
formatting={formatting}
columns={columns}
rows={rows}
style={{ height: '480px' }}
/>
);
}
createRoot(document.getElementById('grid')).render(<App />);
</script>