Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Oct 12, 2023
1 parent 4642baf commit ed1c628
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions bridge/opencensus/internal/ocmetric/metric.go
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit ed1c628

Please sign in to comment.