otel: waterfall shows latest REAL trace (skip dashboard's own poll routes)
This commit is contained in:
@@ -398,10 +398,19 @@
|
||||
:spans (len (otel/trace-spans trace-id))}))
|
||||
(define otel/recent-traces
|
||||
(fn () (reverse (map otel/trace-summary (otel/-trace-ids)))))
|
||||
;; the dashboard's own endpoints — excluded from the "latest trace" so the
|
||||
;; waterfall shows the latest REAL request (a page) instead of the 3s poll.
|
||||
(define otel/-self-route?
|
||||
(fn (route)
|
||||
(or (= route "/otel") (= route "/otel/fragment") (= route "/otel/stream"))))
|
||||
;; the most recent NON-self trace (fall back to any trace if all are self).
|
||||
(define otel/latest-trace
|
||||
(fn ()
|
||||
(let ((r (otel/recent)))
|
||||
(if (empty? r) nil (get (last r) :trace)))))
|
||||
(let ((real (filter (fn (s) (not (otel/-self-route? (get (get s :attrs) :http.route)))) (otel/recent))))
|
||||
(cond
|
||||
((not (empty? real)) (get (last real) :trace))
|
||||
((not (empty? (otel/recent))) (get (last (otel/recent)) :trace))
|
||||
(else nil)))))
|
||||
|
||||
;; ── SSE span events (SXTP) ────────────────────────────────────────────
|
||||
(define otel/span-event
|
||||
|
||||
Reference in New Issue
Block a user