satellite/repair/repairer: metrics for repair bytes uploaded and downloaded

Change-Id: Icb0850692ecc155f6c8169edf1b045b2b546ff48
This commit is contained in:
Cameron Ayer 2021-07-20 10:41:38 -04:00 committed by Stefan Benten
parent adc0fbddfa
commit 373ba8fd27
3 changed files with 10 additions and 0 deletions

View File

@ -90,6 +90,8 @@ storj.io/storj/satellite/repair/repairer."download_failed_not_enough_pieces_repa
storj.io/storj/satellite/repair/repairer."healthy_ratio_after_repair" FloatVal
storj.io/storj/satellite/repair/repairer."healthy_ratio_before_repair" FloatVal
storj.io/storj/satellite/repair/repairer."repair_attempts" Meter
storj.io/storj/satellite/repair/repairer."repair_bytes_downloaded" Meter
storj.io/storj/satellite/repair/repairer."repair_bytes_uploaded" Meter
storj.io/storj/satellite/repair/repairer."repair_failed" Meter
storj.io/storj/satellite/repair/repairer."repair_nodes_unavailable" Meter
storj.io/storj/satellite/repair/repairer."repair_partial" Meter

View File

@ -228,6 +228,8 @@ func (ec *ECRepairer) downloadAndVerifyPiece(ctx context.Context, limit *pb.Addr
pieceReadCloser = tempfile
}
mon.Meter("repair_bytes_downloaded").Mark64(downloadedPieceSize) //mon:locked
if downloadedPieceSize != pieceSize {
return nil, Error.New("didn't download the correct amount of data, want %d, got %d", pieceSize, downloadedPieceSize)
}

View File

@ -315,6 +315,9 @@ func (repairer *SegmentRepairer) Repair(ctx context.Context, queueSegment *queue
return false, repairPutError.Wrap(err)
}
pieceSize := eestream.CalcPieceSize(int64(segment.EncryptedSize), redundancy)
var bytesRepaired int64
// Add the successfully uploaded pieces to repairedPieces
var repairedPieces metabase.Pieces
repairedMap := make(map[uint16]bool)
@ -322,6 +325,7 @@ func (repairer *SegmentRepairer) Repair(ctx context.Context, queueSegment *queue
if node == nil {
continue
}
bytesRepaired += pieceSize
piece := metabase.Piece{
Number: uint16(i),
StorageNode: node.Id,
@ -330,6 +334,8 @@ func (repairer *SegmentRepairer) Repair(ctx context.Context, queueSegment *queue
repairedMap[uint16(i)] = true
}
mon.Meter("repair_bytes_uploaded").Mark64(bytesRepaired) //mon:locked
healthyAfterRepair := len(healthyPieces) + len(repairedPieces)
switch {
case healthyAfterRepair <= int(segment.Redundancy.RepairShares):