From d3d5925747337d7c318fae5c703c15a559d5090b Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Mon, 16 Sep 2024 14:55:01 +0300 Subject: [PATCH] #347 add Sort Labels --- opentracing.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opentracing.go b/opentracing.go index b2d3704..e2f48eb 100644 --- a/opentracing.go +++ b/opentracing.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v3/util/sort" ) var _ tracer.Tracer = &otTracer{} @@ -183,6 +184,8 @@ func (os *otSpan) Finish(opts ...tracer.SpanOption) { options.Labels = options.Labels[:len(options.Labels)-1] } + os.opts.Labels = sort.Uniq(os.opts.Labels) + l := len(options.Labels) for idx := 0; idx < l; idx++ { switch lt := options.Labels[idx].(type) {