cleanup trace spans from cluster slots command
Some checks failed
build / lint (push) Successful in 22s
build / test (push) Failing after 1m30s
codeql / analyze (go) (push) Failing after 1m51s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-07-05 13:44:29 +03:00
parent 518cc1db73
commit b263e14032

View File

@ -68,12 +68,20 @@ func (h *tracingHook) DialHook(hook redis.DialHook) redis.DialHook {
func (h *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
return func(ctx context.Context, cmd redis.Cmder) error {
cmdString := rediscmd.CmdString(cmd)
var err error
_, span := h.tr.Start(ctx, "redis.process", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...)
defer span.Finish()
switch cmdString {
case "cluster slots":
break
default:
_, span := h.tr.Start(ctx, "redis.process", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...)
defer func() {
recordError(span, err)
span.Finish()
}()
}
err := hook(ctx, cmd)
recordError(span, err)
err = hook(ctx, cmd)
return err
}