Skip to content

Commit

Permalink
cli: order span payloads by start_time for readability
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adityamaru committed Jun 7, 2021
1 parent 84499c9 commit a3dadd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cli/debug_job_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a3dadd3

Please sign in to comment.