Task · GOB-0003

Instrument the emit POST: loop.emit span and latency histogram

Status
To Do
Priority
high
Labels
followup-v2, self-obs, tracing
Updated
2026-08-14

Description

Migrated from followup.md §10 (v2 stream) at the 2026-08-14 tracker migration. Also raised as #60 in the pre-migration issue set.

The one real self-observability blind spot. The emit POST to /v1/metrics and /v1/logs uses a plain http.Client, not httpx, so emit latency is in no histogram at all — the only signal is the emit_errors_total counter. A slow or heavily-retried emit is invisible: you can see that it failed, never where the time went or how the per-attempt backoff behaved.

The tick span currently stops at Enqueue. The actual encode → OTLP POST → retry/backoff runs asynchronously in the runner’s worker goroutine, so the hard part is carrying the trace context through the bounded queue into the worker — the batch/queue item has to ferry the context or SpanContext. followup.md §10 calls this the single highest-value next span.

Related but separately tracked: the remaining span coverage (loop.commit, logs_export lifecycle steps, httpx request spans, election).

Acceptance Criteria

Definition of Done

References

View the source file on GitHub