Skip to content

Commit

Permalink
fix(share/shwap/getters): set span err only if all getters truly fail…
Browse files Browse the repository at this point in the history
…ed, otherwise record err in span for single getter failure, not top level
  • Loading branch information
renaynay committed Feb 18, 2025
1 parent 75dca6f commit 25ededc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions share/shwap/getters/cascade.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@ func cascadeGetters[V any](
val, getErr := get(getCtx, getter)
cancel()
if getErr == nil {
err = nil // errors from previous getters already recorded in span
return val, nil
}
log.Debugw("cascade: getter failed", "getter_idx", i, "error", getErr)

if errors.Is(getErr, shwap.ErrOperationNotSupported) {
continue
}

span.RecordError(getErr, trace.WithAttributes(attribute.Int("getter_idx", i)))

var byzantineErr *byzantine.ErrByzantine
if errors.As(getErr, &byzantineErr) {
// short circuit if byzantine error was detected (to be able to handle it correctly
Expand Down

0 comments on commit 25ededc

Please sign in to comment.