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"
|
"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) {
|
func TestKeepTTL(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ func (h *tracingHook) ProcessHook(hook goredis.ProcessHook) goredis.ProcessHook
|
|||||||
case "cluster slots":
|
case "cluster slots":
|
||||||
break
|
break
|
||||||
default:
|
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() {
|
defer func() {
|
||||||
recordError(span, err)
|
recordError(span, err)
|
||||||
span.Finish()
|
span.Finish()
|
||||||
@ -91,11 +91,11 @@ func (h *tracingHook) ProcessPipelineHook(hook goredis.ProcessPipelineHook) gore
|
|||||||
_, cmdsString := rediscmd.CmdsString(cmds)
|
_, cmdsString := rediscmd.CmdsString(cmds)
|
||||||
|
|
||||||
opts := append(h.opts, tracer.WithSpanLabels(
|
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,
|
"db.statement", cmdsString,
|
||||||
))
|
))
|
||||||
|
|
||||||
_, span := h.tr.Start(ctx, "goredis.process_pipeline", opts...)
|
_, span := h.tr.Start(ctx, "sdk.database", opts...)
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
|
||||||
err := hook(ctx, cmds)
|
err := hook(ctx, cmds)
|
||||||
|
Loading…
Reference in New Issue
Block a user