Compare commits

..

2 Commits
v3.10.23 ... v3

Author SHA1 Message Date
31350e8c21 Merge pull request '#347 add Sort Labels' (#47) from kgorbunov/micro-tracer-opentracing:#347-v3 into v3
Some checks failed
build / test (push) Failing after 1s
build / lint (push) Failing after 1s
codeql / analyze (go) (push) Failing after 1s
Reviewed-on: #47
2024-09-16 15:01:07 +03:00
Gorbunov Kirill Andreevich
d3d5925747 #347 add Sort Labels
Some checks failed
autoapprove / autoapprove (pull_request) Failing after 1s
automerge / automerge (pull_request) Has been skipped
dependabot-automerge / automerge (pull_request) Has been skipped
codeql / analyze (go) (pull_request) Has been cancelled
prbuild / test (pull_request) Has been cancelled
prbuild / lint (pull_request) Has been cancelled
2024-09-16 14:55:01 +03:00

View File

@ -10,6 +10,7 @@ import (
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/tracer" "go.unistack.org/micro/v3/tracer"
"go.unistack.org/micro/v3/util/sort"
) )
var _ tracer.Tracer = &otTracer{} var _ tracer.Tracer = &otTracer{}
@ -183,6 +184,8 @@ func (os *otSpan) Finish(opts ...tracer.SpanOption) {
options.Labels = options.Labels[:len(options.Labels)-1] options.Labels = options.Labels[:len(options.Labels)-1]
} }
os.opts.Labels = sort.Uniq(os.opts.Labels)
l := len(options.Labels) l := len(options.Labels)
for idx := 0; idx < l; idx++ { for idx := 0; idx < l; idx++ {
switch lt := options.Labels[idx].(type) { switch lt := options.Labels[idx].(type) {