Skip to content

Commit

Permalink
fix: don't create tags w/ empty name for internal zipkin spans (#2596)
Browse files Browse the repository at this point in the history
#2595
Signed-off-by: Marian Zagoruiko <[email protected]>
  • Loading branch information
mzahor authored Oct 28, 2020
1 parent 8388432 commit c4a3b28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/collector/app/zipkin/jsonv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func spanV2ToThrift(s *models.Span) (*zipkincore.Span, error) {
if err != nil {
return nil, err
}
tSpan.BinaryAnnotations = append(tSpan.BinaryAnnotations, rAddrAnno)
if rAddrAnno != nil {
tSpan.BinaryAnnotations = append(tSpan.BinaryAnnotations, rAddrAnno)
}
}

// add local component to represent service name
Expand Down Expand Up @@ -112,6 +114,8 @@ func remoteEndpToThrift(e *models.Endpoint, kind string) (*zipkincore.BinaryAnno
key = zipkincore.CLIENT_ADDR
case models.SpanKindCONSUMER, models.SpanKindPRODUCER:
key = zipkincore.MESSAGE_ADDR
default:
return nil, nil
}

return &zipkincore.BinaryAnnotation{
Expand Down
1 change: 1 addition & 0 deletions cmd/collector/app/zipkin/jsonv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func TestRemoteEndpToThrift(t *testing.T) {
{kind: models.SpanKindSERVER, expected: &zipkincore.BinaryAnnotation{Key: zipkincore.CLIENT_ADDR, AnnotationType: zipkincore.AnnotationType_BOOL}},
{kind: models.SpanKindPRODUCER, expected: &zipkincore.BinaryAnnotation{Key: zipkincore.MESSAGE_ADDR, AnnotationType: zipkincore.AnnotationType_BOOL}},
{kind: models.SpanKindCONSUMER, expected: &zipkincore.BinaryAnnotation{Key: zipkincore.MESSAGE_ADDR, AnnotationType: zipkincore.AnnotationType_BOOL}},
{kind: "", expected: nil},
}
for _, test := range tests {
banns, err := remoteEndpToThrift(nil, test.kind)
Expand Down

0 comments on commit c4a3b28

Please sign in to comment.