Skip to content

Commit b51e1de

Browse files
Add shard/thread information to the tracing
This information is needed for testing shard awareness. Also it is more in line with cqlsh tracing.
1 parent 1519a00 commit b51e1de

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

session.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,7 @@ func (t *traceWriter) Trace(traceId []byte) {
20882088
activity string
20892089
source string
20902090
elapsed int
2091+
thread string
20912092
)
20922093

20932094
t.mu.Lock()
@@ -2096,13 +2097,13 @@ func (t *traceWriter) Trace(traceId []byte) {
20962097
fmt.Fprintf(t.w, "Tracing session %016x (coordinator: %s, duration: %v):\n",
20972098
traceId, coordinator, time.Duration(duration)*time.Microsecond)
20982099

2099-
iter = t.session.control.query(`SELECT event_id, activity, source, source_elapsed
2100+
iter = t.session.control.query(`SELECT event_id, activity, source, source_elapsed, thread
21002101
FROM system_traces.events
21012102
WHERE session_id = ?`, traceId)
21022103

2103-
for iter.Scan(&timestamp, &activity, &source, &elapsed) {
2104-
fmt.Fprintf(t.w, "%s: %s (source: %s, elapsed: %d)\n",
2105-
timestamp.Format("2006/01/02 15:04:05.999999"), activity, source, elapsed)
2104+
for iter.Scan(&timestamp, &activity, &source, &elapsed, &thread) {
2105+
fmt.Fprintf(t.w, "%s: %s [%s] (source: %s, elapsed: %d)\n",
2106+
timestamp.Format("2006/01/02 15:04:05.999999"), activity, thread, source, elapsed)
21062107
}
21072108

21082109
if err := iter.Close(); err != nil {

0 commit comments

Comments
 (0)