Skip to content

Commit

Permalink
private/piecestore: reduce error cardinality
Browse files Browse the repository at this point in the history
the class name is included in the metrics so
having high cardinality values in a class is
bad for the tsdb. instead use a fixed class
and wrap the error using the format string
with %w.

Change-Id: Ief190428e284dad5fced226797cdd002c6756e7f
  • Loading branch information
zeebo committed May 7, 2024
1 parent 9a8ce9b commit d7c4c59
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions private/piecestore/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package piecestore
import (
"context"
"errors"
"fmt"
"io"
"sync"
"time"
Expand Down Expand Up @@ -302,8 +301,11 @@ func (client *Download) Close() error {

err := client.closingError.Get()
if err != nil {
details := errs.Class(fmt.Sprintf("(Node ID: %s, Piece ID: %s)", client.limit.StorageNodeId.String(), client.limit.PieceId.String()))
err = details.Wrap(Error.Wrap(err))
err = Error.New("(Node ID: %s, Piece ID: %s) %w",
client.limit.StorageNodeId.String(),
client.limit.PieceId.String(),
err,
)
}

return err
Expand Down

0 comments on commit d7c4c59

Please sign in to comment.