From 139b5f63d83e5d86781bd482fb3814c1f9cf009f Mon Sep 17 00:00:00 2001 From: fyuan1316 Date: Mon, 11 Mar 2024 20:35:55 +0800 Subject: [PATCH] Fix Zipkin spanFormat (#5261) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Which problem is this PR solving? - Resolves #5260 ## Description of the changes - ## How was this change tested? - ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` Signed-off-by: Yuan Fang Co-authored-by: Yuri Shkuro Signed-off-by: Vamshi Maskuri --- cmd/collector/app/handler/zipkin_receiver.go | 3 +++ cmd/collector/app/handler/zipkin_receiver_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/cmd/collector/app/handler/zipkin_receiver.go b/cmd/collector/app/handler/zipkin_receiver.go index f2cbff9160ea..a477c970bf19 100644 --- a/cmd/collector/app/handler/zipkin_receiver.go +++ b/cmd/collector/app/handler/zipkin_receiver.go @@ -69,6 +69,9 @@ func startZipkinReceiver( } consumerAdapter := newConsumerDelegate(logger, spanProcessor, tm) + // reset Zipkin spanFormat + consumerAdapter.batchConsumer.spanOptions.SpanFormat = processor.ZipkinSpanFormat + nextConsumer, err := newTraces(consumerAdapter.consume) if err != nil { return nil, fmt.Errorf("could not create Zipkin consumer: %w", err) diff --git a/cmd/collector/app/handler/zipkin_receiver_test.go b/cmd/collector/app/handler/zipkin_receiver_test.go index 8d783588de6a..54abedd19644 100644 --- a/cmd/collector/app/handler/zipkin_receiver_test.go +++ b/cmd/collector/app/handler/zipkin_receiver_test.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/collector/receiver" "github.com/jaegertracing/jaeger/cmd/collector/app/flags" + "github.com/jaegertracing/jaeger/cmd/collector/app/processor" zipkinthrift "github.com/jaegertracing/jaeger/model/converter/thrift/zipkin" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/pkg/testutils" @@ -126,6 +127,7 @@ func TestZipkinReceiver(t *testing.T) { t.Logf("response: %s %s", response.Status, string(bodyBytes)) } require.NoError(t, response.Body.Close()) + require.Equal(t, processor.ZipkinSpanFormat, spanProcessor.getSpanFormat()) }) } }