fixup trace span names
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
c59902201d
commit
77fe9cbef6
@ -12,6 +12,26 @@ import (
|
||||
"go.unistack.org/micro/v3/tracer"
|
||||
)
|
||||
|
||||
func TestLazyConnect(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
var err error
|
||||
|
||||
r := NewStore()
|
||||
|
||||
if err = r.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = r.Connect(ctx); err != nil {
|
||||
t.Logf("connect failed %v", err)
|
||||
}
|
||||
|
||||
for {
|
||||
if err = r.Write(ctx, "mykey", "myval"); err != nil {
|
||||
t.Logf("failed to write %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeepTTL(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
|
@ -73,7 +73,7 @@ func (h *tracingHook) ProcessHook(hook goredis.ProcessHook) goredis.ProcessHook
|
||||
case "cluster slots":
|
||||
break
|
||||
default:
|
||||
_, span := h.tr.Start(ctx, "goredis.process", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...)
|
||||
_, span := h.tr.Start(ctx, "sdk.database", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...)
|
||||
defer func() {
|
||||
recordError(span, err)
|
||||
span.Finish()
|
||||
@ -91,11 +91,11 @@ func (h *tracingHook) ProcessPipelineHook(hook goredis.ProcessPipelineHook) gore
|
||||
_, cmdsString := rediscmd.CmdsString(cmds)
|
||||
|
||||
opts := append(h.opts, tracer.WithSpanLabels(
|
||||
"db.goredis.num_cmd", strconv.Itoa(len(cmds)),
|
||||
"db.database.num_cmd", strconv.Itoa(len(cmds)),
|
||||
"db.statement", cmdsString,
|
||||
))
|
||||
|
||||
_, span := h.tr.Start(ctx, "goredis.process_pipeline", opts...)
|
||||
_, span := h.tr.Start(ctx, "sdk.database", opts...)
|
||||
defer span.Finish()
|
||||
|
||||
err := hook(ctx, cmds)
|
||||
|
Loading…
Reference in New Issue
Block a user