otel: tick P2, log progress

This commit is contained in:
2026-07-01 14:25:18 +00:00
parent 51d4224a55
commit e521909b21

View File

@@ -38,7 +38,7 @@ type-block grammar + type-def editor). You are on branch `loops/otel` in
dynamic parent stack so nesting builds the tree); a bounded ring buffer (`otel/record!`,
`otel/recent`, cap ~1000, drop-oldest); `otel/current-span`/`otel/current-trace`. Tests:
nested with-span builds parent links; ring caps at N.
- [ ] **P2 — monotonic clock.** Find/confirm a time prim on the OCaml host (the warm-conf
- [x] **P2 — monotonic clock.** Find/confirm a time prim on the OCaml host (the warm-conf
profiler + response cache already measure time; grep `lib/host` + the OCaml bridge). Wrap as
`otel/now-ns`. Tests: monotonic non-decreasing, non-negative, a `with-span` has `t1 >= t0`.
- [ ] **P3 — auto-instrument the handlers.** Wrap route handlers at the `host/make-app` / router
@@ -66,5 +66,6 @@ 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 — 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).
- (append one dated line per iteration)