From a3dadd3456f36aa9a117c036bbcae548a2d92da9 Mon Sep 17 00:00:00 2001 From: Aditya Maru Date: Fri, 4 Jun 2021 12:30:41 -0400 Subject: [PATCH] cli: order span payloads by start_time for readability During job execution, there can be several root spans on a node. Egs: resumer, processor While the recordings within a span are sorted by start time, since the root spans are stored in an unordered map, the recordings across root spans might not be sorted by start_time. When viewing the output files for a job this results in the processor span printing its payload before the job payload which is not intuitive. We might change how we display recordings in the future, but for the time being this fix makes the "ordering" of events deterministic. Release note: None --- pkg/cli/debug_job_trace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cli/debug_job_trace.go b/pkg/cli/debug_job_trace.go index 685eafbde0dc..54a68e44ba2d 100644 --- a/pkg/cli/debug_job_trace.go +++ b/pkg/cli/debug_job_trace.go @@ -100,7 +100,7 @@ SELECT span_id, goroutine_id, operation, start_time, duration FROM crdb_internal.node_inflight_trace_spans WHERE trace_id=$1 ) SELECT * -FROM spans, LATERAL crdb_internal.payloads_for_span(spans.span_id)` +FROM spans, LATERAL crdb_internal.payloads_for_span(spans.span_id) ORDER BY spans.start_time` var f *os.File if f, err = os.Create(traceFilePath); err != nil {