From a7a61df3727fa484999c80ee57db021ea59e13d7 Mon Sep 17 00:00:00 2001 From: notanatol Date: Sat, 4 Nov 2023 11:54:41 +0200 Subject: [PATCH] fix: noOp span --- pkg/api/bzz.go | 1 + pkg/pusher/pusher.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/api/bzz.go b/pkg/api/bzz.go index 0de046af574..00c86ad8040 100644 --- a/pkg/api/bzz.go +++ b/pkg/api/bzz.go @@ -247,6 +247,7 @@ func (s *Service) fileUploadHandler( } span.LogFields(olog.Bool("success", true)) + span.SetTag("root_address", manifestReference) if tagID != 0 { w.Header().Set(SwarmTagHeader, fmt.Sprint(tagID)) diff --git a/pkg/pusher/pusher.go b/pkg/pusher/pusher.go index bd1c49e9879..2fcaebf3953 100644 --- a/pkg/pusher/pusher.go +++ b/pkg/pusher/pusher.go @@ -168,7 +168,12 @@ func (s *Service) chunksWorker(warmupTime time.Duration, tracer *tracing.Tracer) s.metrics.TotalToPush.Inc() startTime := time.Now() - spanCtx := tracing.WithContext(ctx, op.Span.Context()) + spanCtx := ctx + if op.Span != nil { + spanCtx = tracing.WithContext(spanCtx, op.Span.Context()) + } else { + op.Span = opentracing.NoopTracer{}.StartSpan("noOp") + } if op.Direct { err = s.pushDirect(spanCtx, s.logger, op)