support never micro context attrs funcs
Some checks failed
build / lint (push) Successful in 24s
build / test (push) Failing after 1m30s
codeql / analyze (go) (push) Failing after 1m55s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-07-06 00:19:38 +03:00
parent 9b553cfa62
commit 2149a713d5
3 changed files with 12 additions and 2 deletions

4
go.mod
View File

@ -6,6 +6,6 @@ toolchain go1.22.2
require (
github.com/opentracing/opentracing-go v1.2.0
go.opentelemetry.io/otel v1.26.0
go.unistack.org/micro/v3 v3.10.77
go.opentelemetry.io/otel v1.28.0
go.unistack.org/micro/v3 v3.10.81
)

4
go.sum
View File

@ -13,7 +13,11 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs=
go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4=
go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo=
go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
go.unistack.org/micro/v3 v3.10.77 h1:nn731y84q3S8a4UgpVdC/wN9cs30ruZeH81rKw6XcUc=
go.unistack.org/micro/v3 v3.10.77/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
go.unistack.org/micro/v3 v3.10.81 h1:zHttMUEwL/f9GtrNAQOk8bK0NrEwAuKeUW8DEoywgJI=
go.unistack.org/micro/v3 v3.10.81/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -49,9 +49,15 @@ type spanContext interface {
func (t *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) {
options := tracer.NewSpanOptions(opts...)
if len(options.Labels)%2 != 0 {
options.Labels = options.Labels[:len(options.Labels)-1]
}
for _, fn := range t.opts.ContextAttrFuncs {
options.Labels = append(options.Labels, fn(ctx)...)
}
var span ot.Span
switch options.Kind {
case tracer.SpanKindUnspecified: