From dc8fb76245a89c1e87172bf185adf221b5345c30 Mon Sep 17 00:00:00 2001 From: Marian Zagoruiko Date: Wed, 28 Oct 2020 17:43:29 +0200 Subject: [PATCH] fix: don't create tags w/ empty name for internal zipkin spans https://github.com/jaegertracing/jaeger/issues/2595 Signed-off-by: Marian Zagoruiko --- cmd/collector/app/zipkin/jsonv2.go | 6 +++++- cmd/collector/app/zipkin/jsonv2_test.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/collector/app/zipkin/jsonv2.go b/cmd/collector/app/zipkin/jsonv2.go index a89f269429e..35a15f70073 100644 --- a/cmd/collector/app/zipkin/jsonv2.go +++ b/cmd/collector/app/zipkin/jsonv2.go @@ -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 @@ -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{ diff --git a/cmd/collector/app/zipkin/jsonv2_test.go b/cmd/collector/app/zipkin/jsonv2_test.go index c7e4420a016..2c53c18d8bf 100644 --- a/cmd/collector/app/zipkin/jsonv2_test.go +++ b/cmd/collector/app/zipkin/jsonv2_test.go @@ -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)