From ed1c6281ec3896382c591ae5e7b198ccff17bec7 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 12 Oct 2023 13:55:14 +0000 Subject: [PATCH] cleanup --- bridge/opencensus/internal/ocmetric/metric.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index d6a976a3d7a7..08cfbebae313 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -194,9 +194,6 @@ func convertExemplar(ocExemplar *ocmetricdata.Exemplar) (metricdata.Exemplar[flo Value: ocExemplar.Value, Time: ocExemplar.Timestamp, } - if ocExemplar.Attachments == nil { - return exemplar, nil - } var err error for k, v := range ocExemplar.Attachments { switch { @@ -209,14 +206,13 @@ func convertExemplar(ocExemplar *ocmetricdata.Exemplar) (metricdata.Exemplar[flo exemplar.SpanID = sc.SpanID[:] exemplar.TraceID = sc.TraceID[:] default: - kv := convertKV(k, v); kv.Valid() + kv := convertKV(k, v) if !kv.Valid() { err = errors.Join(err, fmt.Errorf("%w; type: %v", errInvalidExemplarAttachmentValue, reflect.TypeOf(v))) continue } exemplar.FilteredAttributes = append(exemplar.FilteredAttributes, kv) } - } } sortable := attribute.Sortable(exemplar.FilteredAttributes) sort.Sort(&sortable)