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

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: