Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var _ json.Marshaler = nilTraceID
// IsValid checks whether the trace TraceID is valid. A valid trace ID does
// not consist of zeros only.
func (t TraceID) IsValid() bool {
return !bytes.Equal(t[:], nilTraceID[:])
return !bytes.Equal(t[:], nilTraceID[:]) && len(t) == len(nilTraceID)
}

// MarshalJSON implements a custom marshal function to encode TraceID
Expand All @@ -77,7 +77,7 @@ var _ json.Marshaler = nilSpanID
// IsValid checks whether the SpanID is valid. A valid SpanID does not consist
// of zeros only.
func (s SpanID) IsValid() bool {
return !bytes.Equal(s[:], nilSpanID[:])
return !bytes.Equal(s[:], nilSpanID[:]) && len(s) == len(nilSpanID)
}

// MarshalJSON implements a custom marshal function to encode SpanID
Expand Down