Skip to content

Commit

Permalink
tracing: offer structured payloads to verbose log
Browse files Browse the repository at this point in the history
When a payload is added, and the Span is verbose, also
stringify the payload into the verbose log.

Release note: None
  • Loading branch information
tbg committed Jan 12, 2021
1 parent 3d029cc commit 3f5eebd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/util/tracing/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package tracing

import (
"fmt"
"strings"
"time"

"github.com/cockroachdb/cockroach/pkg/util/protoutil"
Expand Down Expand Up @@ -331,6 +332,11 @@ func (s *Span) LogStructured(item Structured) {
return
}
s.crdb.logStructured(item)
if s.hasVerboseSink() {
// NB: TrimSpace avoids the trailing whitespace
// generated by the protobuf stringers.
s.Record(strings.TrimSpace(item.String()))
}
}

// Record provides a way to record free-form text into verbose spans.
Expand Down

0 comments on commit 3f5eebd

Please sign in to comment.