diff --git a/go.mod b/go.mod index 6211712..5ce83ec 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index e9dbe68..68e829a 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/opentracing.go b/opentracing.go index 1f3454d..1bfaff7 100644 --- a/opentracing.go +++ b/opentracing.go @@ -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: