add ability to pass span options on finish
Some checks failed
build / test (push) Failing after 1m38s
codeql / analyze (go) (push) Failing after 1m54s
build / lint (push) Successful in 9m17s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-05-09 19:30:32 +03:00
parent 65ac3aff56
commit 9b553cfa62
4 changed files with 39 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ package opentracing
import (
"context"
"fmt"
"testing"
"github.com/opentracing/opentracing-go/mocktracer"
@@ -46,8 +47,15 @@ func TestTraceTags(t *testing.T) {
var sp tracer.Span
ctx, sp = tr.Start(ctx, "test", tracer.WithSpanLabels("key", "val", "odd"))
sp.Finish()
sp.Finish(tracer.WithSpanLabels("xkey", "xval"))
_ = ctx
msp := mtr.FinishedSpans()[0]
t.Logf("mock span %#+v", msp.Tags())
if "val" != fmt.Sprintf("%v", msp.Tags()["key"]) {
t.Fatal("mock span invalid")
}
if "xval" != fmt.Sprintf("%v", msp.Tags()["xkey"]) {
t.Fatalf("mock span invalid %#+v", msp)
}
}