From 6f7aea45fd51ebdaaff0142e5060fac0a7bae89f Mon Sep 17 00:00:00 2001 From: DylanGuedes Date: Fri, 21 Jun 2024 09:28:45 -0300 Subject: [PATCH] add sp nil check --- pkg/storage/stores/shipper/bloomshipper/client.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/storage/stores/shipper/bloomshipper/client.go b/pkg/storage/stores/shipper/bloomshipper/client.go index 545a10528f3f6..f6da2168ae91f 100644 --- a/pkg/storage/stores/shipper/bloomshipper/client.go +++ b/pkg/storage/stores/shipper/bloomshipper/client.go @@ -494,15 +494,16 @@ func newCachedListOpObjectClient(oc client.ObjectClient, ttl, interval time.Dura func (c *cachedListOpObjectClient) List(ctx context.Context, prefix string, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error) { var ( - sp = opentracing.SpanFromContext(ctx) start = time.Now() cacheDur time.Duration ) defer func() { - sp.LogKV( - "cache_duration", cacheDur, - "total_duration", time.Since(start), - ) + if sp := opentracing.SpanFromContext(ctx); sp != nil { + sp.LogKV( + "cache_duration", cacheDur, + "total_duration", time.Since(start), + ) + } }() if delimiter != "" {