In the last post I moved every packet between eglu’s cloud and its hubs out of Loki and into ClickHouse. That made them queryable. It didn’t make them readable. The people who debug hubs read packets byte by byte, and taking the text logs away meant I owed them a screen.


Three Dashboards

  • Hub traffic: the whole fleet. Who’s busy, who went quiet, who floods.
  • Hub traffic - single hub: one hub’s rates and commands.
  • Hub traffic - raw packets: the packets themselves, newest first.

Grafana reads through read-only ClickHouse users. The live one is capped at 2M rows read and 10k rows returned per query, so no panel can scan the fleet by accident. One busy hub’s full day loads in under 70 ms per panel.

The Decision

The same ClickHouse takes every packet from about 5,000 hubs. Any work a dashboard puts on it competes with ingest. So the rule: ClickHouse filters and returns the bytes as plain hex(). Nothing else.

Everything a person does with those rows after that happens in the browser.

Formatting. For a while I spaced the bytes in SQL. That’s string work on the server, for every row, on every refresh, only so it looks right on screen. Now the query is plain hex(col), and the panel lowercases, spaces and wraps it.

Monospace hex, spaced per byte, wrapped to fit. Test data, random bytes.

Grep. A box above the table filters the loaded rows and highlights the matches: bytes in plain mode, or a regex over the hex as shown. A grep that went to the database would be a query per keystroke. In the browser it takes 2 to 6 ms, and ClickHouse never hears about it.

Regex grep: 2 of 11 rows kept, matches highlighted across wrapped lines.

Download. A button saves the rows shown, as shown, as CSV: after grep, in the table’s sort, hex spaced. It’s built from the data already loaded. No second query.

The download button saves the rows shown, as shown.

This only works because the query is already bounded. The dashboard filters and the row cap mean the browser always gets a small, known set of rows. ClickHouse does the expensive part once, the part it’s good at. The browser does the cheap part as often as people like.

Who Did What

Claude Code was my coworker on this. It built the panel: Grafana’s own table in a monospace theme (Grafana has no monospace cells), grep that matches on byte boundaries, highlighting that doesn’t disturb the table, CSV from the loaded rows. It tested against a local Grafana and came back. I looked, decided what stayed, and sent it round again. Copy buttons got built and dropped.

It could build all of that. What it couldn’t do was decide where the work belongs. “Keep the load off ClickHouse” isn’t written anywhere in the code, but every feature follows from it. That part was mine, and it’s the part worth writing down.

That’s also why this post has less code than usual. Code is the easy part to get now. The decision isn’t.

Numbers

  • One busy hub’s full day: under 70 ms per panel.
  • 10k rows render in 0.6 s the first time.
  • Grep: 2 to 6 ms per keystroke.
  • 286-byte packets wrap fully.