Skip to content

Commit

Permalink
Add shard information to the tracing
Browse files Browse the repository at this point in the history
This information is needed for testing shard awareness.
Also it is more in line with cqlsh tracing.
  • Loading branch information
sylwiaszunejko committed Jul 19, 2023
1 parent 1519a00 commit 6a1c286
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,7 @@ func (t *traceWriter) Trace(traceId []byte) {
activity string
source string
elapsed int
thread string
)

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

iter = t.session.control.query(`SELECT event_id, activity, source, source_elapsed
iter = t.session.control.query(`SELECT event_id, activity, source, source_elapsed, thread
FROM system_traces.events
WHERE session_id = ?`, traceId)

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

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

0 comments on commit 6a1c286

Please sign in to comment.