html-revisor: observability

What html-revisor tells Honeycomb about a save, from your keystroke to the file on disk and back, and the queries that show it.

Turn it on

HRV_TELEMETRY=1 OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=<ingest key> ./run

HRV_TELEMETRY is the switch. Without it the server sends nothing, whatever OTEL_* variables it inherits. With it, the standard variables say where spans go. Spans land in team modernity, environment local, dataset html-revisor (the service name). .be in this repo holds the key and the variables.

The server tells the page that telemetry is on, and only then does the browser record spans. A failed export prints telemetry export failed on the server's stderr.

One save, as a trace

A directive typed on this page and closed with Escape, which sends it at once instead of after 0.4 s of quiet. The browser's spans are purple; the server's are blue. Times from trace d0888bfe….

save directive close box 13.4 ms hrv.wait.ms 106 · hrv.quiet.ms 97 · hrv.edits 22 PUT (client) 13.1 ms PUT change 10.6 ms read, parse, serialize, write, reparse, bases 0.1–1.9 ms each apply 0.3 ms

The save span starts when the change goes out. The typing before it is in two attributes: hrv.wait.ms since the first keystroke, hrv.quiet.ms since the last. The round trip is about 13 ms on this 14 KB page. Most server steps take under 2 ms here. A step that stays under 1 ms on a big page too doesn't earn its span. set directive keeps its span: it passed 1 ms once, at 1.17 ms on a page over 30 KB.

A PUT change with no write file step saved what the file already holds, and hrv.wrote is false on it. Typing makes these: the server trims a directive, so a trailing space changes nothing, and in markdown a trailing space at the end of a paragraph is gone in the canonical file. A refused save (412, 400) stops before that step too.

Spans

Span Where From → to Attributes
save directive, save markdown browser from when we decide to save, until the page has been updated hrv.change.kind, hrv.scope.id, hrv.element (tag name), hrv.edits (keystrokes in this one save), hrv.wait.ms (first keystroke → sent, queue included), hrv.quiet.ms (last keystroke → sent), hrv.html.before, hrv.html.after (markdown saves), hrv.markdown.before, hrv.markdown.after or hrv.directive.before, hrv.directive.after; each text with a .length. hrv.reverted on markdown saves: true when this save carries a Revert. Revert types the committed markdown into the field, so it counts as one more edit, and hrv.markdown.before is what it threw away. hrv.directive on both kinds: the scope's directive once the save lands. hrv.box.session: one ID per box opened, shared by its saves and its done.
PUT browser PUT sent → answer received; its traceparent makes the server span its child. client.js makes it; no instrumentation library. hrv.queued (changes behind it), http.response.status_code
apply browser answer received → page updated
close box (event) browser a dot on the save going out when the box closes (Done, Escape, a click away, another box, a ⌘-click on a link); none when no save is going hrv.close.by, hrv.scope.id, hrv.pending (saves still waiting behind it)
done browser box closed → the server's answer; it waits behind the box's saves. Its traceparent makes POST done its child. A trace of its own. hrv.box.session, hrv.scope.id, hrv.close.by, hrv.queued (saves ahead of it), hrv.announced, http.response.status_code
POST done server request → response; a child span per step hrv.page, hrv.scope.id, hrv.announced
PUT change server request → response; a child span per step hrv.page, hrv.page.bytes, hrv.change.kind, hrv.scope.id, hrv.change.bytes, hrv.directive.count, hrv.answer.bytes, hrv.conflict, hrv.wrote
GET page server request → response; a child span per step hrv.page, hrv.page.bytes, hrv.normalized, hrv.element.count, hrv.scope.count, hrv.answer.bytes

Browser spans carry hrv.side = browser. A conflict or a failed save marks the browser's spans as errors. A text attribute stops at 50,000 characters, under Honeycomb's 64 KB limit; its .length is the full count. Server spans take their times from performance.now() on an anchor to the wall clock, so steps in one request start in order, to the microsecond.

Not recorded yet

Action Now Planned
Opening a box No span. A scope's size shows up only when you save it. Closing the box makes a done span, and everything from one box shares hrv.box.session. Undecided. For a scope's size without changing it, edit it and Revert.

Queries

All of them are on one board: html-revisor: saves, over the last 24 hours, with filters for page and change kind. Each link below opens one in Honeycomb over the last two hours of dataset html-revisor.

How the browser's spans get there

browser client.js: spans as plain objects server each one an OTel span, same IDs and times Honeycomb dataset html-revisor PUT + traceparent POST /.hrv/spans every 2 s, and on hide OTLP with the ingest key no SDK, no key server spans join the same trace

The browser has no OpenTelemetry SDK. client.js records each span as a plain object (trace ID, span ID, parent, start and end, attributes, events) and posts a batch to /.hrv/spans every 2 s and when the tab hides. The server makes each one an OTel span with the browser's IDs and times, and sends it with its own spans. That route makes no span of its own.

Two reasons for no SDK. client.js is a plain script inlined into every page, with no build, and the web SDK would need a bundle. And a browser exporting to Honeycomb would need the ingest key in the page; through the server, the key stays on the server.

Checking it

test/telemetry.test.mjs checks the spans against a stand-in collector. Given .be's variables, it also sends to Honeycomb (dataset html-revisor-test) and prints a run ID and trace ID. The ingest key can't read; an agent finds the trace with the honeycomb-modernity MCP.