otel: hover tooltips on waterfall bars (SVG <title>)

This commit is contained in:
2026-07-02 11:00:40 +00:00
parent 4f17a40187
commit ca80df9ade

View File

@@ -213,11 +213,15 @@
(fn (status) (if (= status "error") "#e45756" "#4c9a8f")))
;; one <g> (bar + name + duration) per rect. The bar is the only <rect>, so
;; count(rect) == count(span); axis chrome uses <line>/<text>.
;; count(rect) == count(span); axis chrome uses <line>/<text>. A leading <title>
;; gives a native hover tooltip with the full span name (the inline label clips on
;; narrow bars).
(define otel/-rect->g
(fn (r)
(quasiquote
(g
(title (unquote (str (get r :name) " · " (otel/-ms (get r :dur))
(if (= (get r :status) "error") " · error" ""))))
(rect :x (unquote (get r :x)) :y (unquote (get r :y))
:width (unquote (get r :w)) :height (unquote (- otel/-row-h 2))
:fill (unquote (otel/-bar-fill (get r :status))) :rx 2)