Skip to content

Commit

Permalink
feat: add seed peer back source traffic (#1738)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <majinjing3@gmail.com>
  • Loading branch information
jim3ma committed Oct 10, 2022
1 parent 3f9309c commit e4b0c95
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scheduler/resource/seed_peer.go
Expand Up @@ -28,6 +28,7 @@ import (

"d7y.io/dragonfly/v2/pkg/rpc/common"
pkgtime "d7y.io/dragonfly/v2/pkg/time"
"d7y.io/dragonfly/v2/scheduler/metrics"
)

const (
Expand Down Expand Up @@ -137,6 +138,8 @@ func (s *seedPeer) TriggerTask(ctx context.Context, task *Task) (*Peer, *schedul
peer.FinishedPieces.Set(uint(piece.PieceInfo.PieceNum))
peer.AppendPieceCost(pkgtime.SubNano(int64(piece.EndTime), int64(piece.BeginTime)).Milliseconds())
task.StorePiece(piece.PieceInfo)

metrics.Traffic.WithLabelValues(peer.Tag, peer.Application, metrics.TrafficBackToSourceType).Add(float64(piece.PieceInfo.RangeSize))
}

// Handle end of piece.
Expand Down

0 comments on commit e4b0c95

Please sign in to comment.