Skip to content

Commit 3b341fa

Browse files
Maksym Trofimenkoclaude
andcommitted
fix: show trace timing on sink nodes (no output ports)
ApplyTraceStatToNode only checked source handles for latency, so sink nodes like Debug never displayed span timing. Add a third pass that matches target handles against edge latency keys. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 16cc96f commit 3b341fa

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

pkg/utils/trace.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package utils
33
import (
44
"fmt"
55
"math"
6+
"strings"
67
)
78

89
const (
@@ -200,6 +201,30 @@ func ApplyTraceStatToNode(nodeMap map[string]interface{}, ts *TraceStatistics) {
200201
return
201202
}
202203

204+
// Third pass: check target handles for edge latency (sink nodes with no output ports)
205+
for _, handle := range handles {
206+
handleMap, ok := handle.(map[string]interface{})
207+
if !ok {
208+
continue
209+
}
210+
if GetStr(handleMap["type"]) != "target" {
211+
continue
212+
}
213+
target := GetPortFullName(nodeID, GetStr(handleMap["id"]))
214+
for key, lat := range ts.Latencies {
215+
if !strings.HasSuffix(key, target) || key == target {
216+
continue
217+
}
218+
data["trace"] = map[string]interface{}{
219+
"error": hasError,
220+
"latency": lat,
221+
"port": GetStr(handleMap["id"]),
222+
"sequence": getIndexByValue(ts.Sequence, key),
223+
}
224+
return
225+
}
226+
}
227+
203228
// Fallback: check non-visible ports (like setting or control ports)
204229
for port, lat := range ts.Latencies {
205230
node, portName := ParseFullPortName(port)

0 commit comments

Comments
 (0)