support never micro context attrs funcs
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
9b553cfa62
commit
2149a713d5
4
go.mod
4
go.mod
@ -6,6 +6,6 @@ toolchain go1.22.2
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/opentracing/opentracing-go v1.2.0
|
github.com/opentracing/opentracing-go v1.2.0
|
||||||
go.opentelemetry.io/otel v1.26.0
|
go.opentelemetry.io/otel v1.28.0
|
||||||
go.unistack.org/micro/v3 v3.10.77
|
go.unistack.org/micro/v3 v3.10.81
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
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=
|
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 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs=
|
||||||
go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4=
|
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 h1:nn731y84q3S8a4UgpVdC/wN9cs30ruZeH81rKw6XcUc=
|
||||||
go.unistack.org/micro/v3 v3.10.77/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
|
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 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
@ -49,9 +49,15 @@ type spanContext interface {
|
|||||||
|
|
||||||
func (t *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) {
|
func (t *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOption) (context.Context, tracer.Span) {
|
||||||
options := tracer.NewSpanOptions(opts...)
|
options := tracer.NewSpanOptions(opts...)
|
||||||
|
|
||||||
if len(options.Labels)%2 != 0 {
|
if len(options.Labels)%2 != 0 {
|
||||||
options.Labels = options.Labels[:len(options.Labels)-1]
|
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
|
var span ot.Span
|
||||||
switch options.Kind {
|
switch options.Kind {
|
||||||
case tracer.SpanKindUnspecified:
|
case tracer.SpanKindUnspecified:
|
||||||
|
Loading…
Reference in New Issue
Block a user