fixup add labels
Some checks failed
build / test (push) Failing after 1m43s
codeql / analyze (go) (push) Failing after 1m43s
build / lint (push) Successful in 9m13s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-05-06 01:09:41 +03:00
parent e9933df477
commit 65ac3aff56

View File

@ -128,14 +128,15 @@ func (os *otSpan) Finish(opts ...tracer.SpanOption) {
return
}
l := len(options.Labels)
labels := append(options.Labels, os.labels...)
l := len(labels)
for idx := 0; idx < l; idx++ {
switch lt := options.Labels[idx].(type) {
switch lt := labels[idx].(type) {
case attribute.KeyValue:
os.span.SetTag(string(lt.Key), lt.Value.AsInterface())
case string:
if l > idx+1 {
os.span.SetTag(lt, options.Labels[idx+1])
os.span.SetTag(lt, labels[idx+1])
idx++
}
}