otel: wire /otel into the SPA (dual-mode SX + sx-trigger poll refresh)

This commit is contained in:
2026-07-01 20:31:44 +00:00
parent 7754666de1
commit 44d29866e7
2 changed files with 25 additions and 12 deletions

View File

@@ -234,7 +234,8 @@
(host-ot-test "dashboard has the root id" (contains? host-ot-dash "otel-dashboard") true)
(host-ot-test "dashboard SSRs the waterfall svg" (contains? host-ot-dash "<svg") true)
(host-ot-test "dashboard shows a route in the strip" (contains? host-ot-dash "/feed") true)
(host-ot-test "dashboard auto-refreshes (meta refresh, not fake SSE)" (contains? host-ot-dash "refresh") true)
(host-ot-test "dashboard self-refreshes via SPA poll (sx-trigger)" (contains? host-ot-dash "every 3s") true)
(host-ot-test "dashboard poll targets itself" (contains? host-ot-dash "otel-dashboard") true)
(host-ot-test "dashboard shows the latency chart legend" (contains? host-ot-dash "p99 (tail)") true)
;; the SSE endpoint emits a span event, SSE-framed
@@ -252,13 +253,18 @@
(define host-ot-ev (otel/latest-span-event))
(host-ot-test "latest span event type" (str (get host-ot-ev :type)) "otel.span")
;; mounted through make-app: GET /otel serves the dashboard page
;; mounted through make-app: a BOOSTED GET /otel returns the text/sx fragment (the
;; SPA path — serialize, no render-page, so it's conformance-safe). The direct/
;; full-page path uses render-page (a server-env prim absent here) and is exercised
;; live, not in conformance.
(otel/reset!)
(feed/reset!)
(define host-ot-mapp (host/make-app (list host/feed-routes otel/routes)))
(define host-ot-otelresp (host-ot-mapp (dream-request "GET" "/otel" {} "")))
(host-ot-test "GET /otel status 200" (dream-status host-ot-otelresp) 200)
(host-ot-test "GET /otel serves the dashboard"
(define host-ot-otelresp (host-ot-mapp (dream-request "GET" "/otel" {"sx-request" "true"} "")))
(host-ot-test "GET /otel (boosted) status 200" (dream-status host-ot-otelresp) 200)
(host-ot-test "GET /otel (boosted) is text/sx"
(contains? (str (dream-headers host-ot-otelresp)) "text/sx") true)
(host-ot-test "GET /otel (boosted) serves the dashboard fragment"
(contains? (dream-resp-body host-ot-otelresp) "otel-dashboard") true)
;; empty ring → dashboard still SSRs (a placeholder, no svg)