From 518cc1db7325c4dafa316c93b9a748e121afba5a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 5 Jul 2024 12:59:05 +0300 Subject: [PATCH] fixup duplicate nested redis span Signed-off-by: Vasiliy Tolstov --- tracer.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tracer.go b/tracer.go index 45b640b..60d8fea 100644 --- a/tracer.go +++ b/tracer.go @@ -55,10 +55,10 @@ func newTracingHook(connString string, tr tracer.Tracer, opts ...tracer.SpanOpti func (h *tracingHook) DialHook(hook redis.DialHook) redis.DialHook { return func(ctx context.Context, network, addr string) (net.Conn, error) { - sctx, span := h.tr.Start(ctx, "redis.dial", h.opts...) + _, span := h.tr.Start(ctx, "redis.dial", h.opts...) defer span.Finish() - conn, err := hook(sctx, network, addr) + conn, err := hook(ctx, network, addr) recordError(span, err) return conn, err @@ -69,10 +69,10 @@ func (h *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook { return func(ctx context.Context, cmd redis.Cmder) error { cmdString := rediscmd.CmdString(cmd) - sctx, span := h.tr.Start(ctx, "redis.process", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...) + _, span := h.tr.Start(ctx, "redis.process", append(h.opts, tracer.WithSpanLabels("db.statement", cmdString))...) defer span.Finish() - err := hook(sctx, cmd) + err := hook(ctx, cmd) recordError(span, err) return err @@ -88,10 +88,10 @@ func (h *tracingHook) ProcessPipelineHook(hook redis.ProcessPipelineHook) redis. "db.statement", cmdsString, )) - sctx, span := h.tr.Start(ctx, "redis.process_pipeline", opts...) + _, span := h.tr.Start(ctx, "redis.process_pipeline", opts...) defer span.Finish() - err := hook(sctx, cmds) + err := hook(ctx, cmds) recordError(span, err) return err