otel: tick P4, log progress + splice-unquote gotcha
This commit is contained in:
@@ -45,7 +45,7 @@ type-block grammar + type-def editor). You are on branch `loops/otel` in
|
||||
seam (see `lib/host/server.sx`) so every HTTP request becomes a trace: a root span per request
|
||||
named by method+route, with `{:http.method :http.route :http.status}` attrs. Tests: a request
|
||||
through the app produces one trace with the right span name + status attr.
|
||||
- [ ] **P4 — render-fold → SVG waterfall.** A trace → an inline `<svg>` timeline: one `<rect>`
|
||||
- [x] **P4 — render-fold → SVG waterfall.** A trace → an inline `<svg>` timeline: one `<rect>`
|
||||
per span, `x` ∝ (t0 − trace.t0), `width` ∝ duration, `y` ∝ depth, a label. Reuse the
|
||||
compose-fold walk shape. Tests: N spans → N rects; nested spans get increasing y.
|
||||
- [ ] **P5 — metrics (aggregate-fold).** Fold recent spans → per-route counters (request count)
|
||||
@@ -66,6 +66,7 @@ type-block grammar + type-def editor). You are on branch `loops/otel` in
|
||||
+ an event). Tests: traceparent round-trips; an error thunk yields an error span.
|
||||
|
||||
## Progress log (newest first)
|
||||
- 2026-07-01 — P4 done. `otel/waterfall-rects` folds a trace's spans → rect geometry (x ∝ t0−trace.t0, width ∝ duration, y ∝ depth via `otel/-depth` parent-link ancestor count; zero-dur spans get a 1px sliver). `otel/waterfall` folds those into an inline `(svg … (g (rect …) (text …)) …)` — one rect+label per span — which `render-to-html` emits as real SVG (verified: nested `db` span at y=22 below its `GET /feed` root at y=4). Suite 50/50 (13 new: rect-per-span, depth 0/1/2, increasing-y with nesting, positive widths, svg head + rect/label counts via `otel/-tree-count`, empty-trace). GOTCHA: this evaluator's quasiquote splice symbol is `splice-unquote`, NOT `unquote-splicing` (plain `unquote` is fine) — the wrong name serialised literally and produced 0 rects.
|
||||
- 2026-07-01 — P3 done. `otel/instrument-routes` wraps each flattened Dream route's handler in a timed span "METHOD /route" with `{:http.method :http.route :http.status}`; `host/make-app` applies it (seam) so every matched request is a trace. Refactored `with-span` onto a shared `otel/-timed` core with a `finalize` fn for result-derived attrs (http.status is only known post-handler; bare-string handler results coerced → 200). Suite 37/37; server 13/13 unchanged. NOTE: cold `conformance.sh feed|relations|blog` currently fail at test-file load with `Undefined symbol: parse-safe`/`render-page` — these are `bind`-registered server-env prims in `sx_server.ml` not resolving in the current shared binary's epoch context; **pre-existing & environmental** (reproduces with my P3 changes stashed), NOT caused by this work. otel/server/page suites unaffected.
|
||||
- 2026-07-01 — P2 done. Host time prim is `clock-milliseconds` (OCaml `Unix.gettimeofday`, epoch ms; no dedicated nano/monotonic prim). `otel/now-ns` wraps it as epoch NANOSECONDS (×1e6, the OTLP unit) with a high-water clamp so it never steps backwards → durations non-negative across NTP steps. P1 placeholder counter removed. Suite 23/23 (added: non-negative, monotonic non-decreasing, ns-scale, real with-span t1≥t0 + ns-scale t0).
|
||||
- 2026-07-01 — P1 done. `lib/host/otel.sx`: span dict + `otel/with-span` (dynamic parent stack builds the trace tree), monotonic id/clock placeholders (P2 replaces now-ns), bounded ring buffer (`record!`/`recent`/`set-cap!`, drop-oldest), `current-span`/`current-trace`, `reset!`. Suite `lib/host/tests/otel.sx` wired into conformance — 18/18 (nested parent links, attrs, ring caps at N drops oldest).
|
||||
|
||||
Reference in New Issue
Block a user