fix: DownloadPeerDuration observe cost by milliseconds (#3255)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2024-05-10 14:12:17 +08:00 committed by GitHub
parent c40cba5208
commit 8237c94671
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

@ -1 +1 @@
Subproject commit 0b365fafdecf9f8d009ab49c7e22ec95e627de8b Subproject commit 6d13d8808b763662971cc7aa4b0525b2f4866276

View File

@ -1014,7 +1014,7 @@ func (v *V2) handleDownloadPeerFinishedRequest(ctx context.Context, peerID strin
metrics.DownloadPeerCount.WithLabelValues(priority.String(), peer.Task.Type.String(), metrics.DownloadPeerCount.WithLabelValues(priority.String(), peer.Task.Type.String(),
peer.Task.Tag, peer.Task.Application, peer.Host.Type.Name()).Inc() peer.Task.Tag, peer.Task.Application, peer.Host.Type.Name()).Inc()
// TODO to be determined which traffic type to use, temporarily use TrafficType_REMOTE_PEER instead // TODO to be determined which traffic type to use, temporarily use TrafficType_REMOTE_PEER instead
metrics.DownloadPeerDuration.WithLabelValues(metrics.CalculateSizeLevel(peer.Task.ContentLength.Load()).String()).Observe(float64(peer.Cost.Load())) metrics.DownloadPeerDuration.WithLabelValues(metrics.CalculateSizeLevel(peer.Task.ContentLength.Load()).String()).Observe(float64(peer.Cost.Load().Milliseconds()))
return nil return nil
} }
@ -1047,7 +1047,7 @@ func (v *V2) handleDownloadPeerBackToSourceFinishedRequest(ctx context.Context,
metrics.DownloadPeerCount.WithLabelValues(priority.String(), peer.Task.Type.String(), metrics.DownloadPeerCount.WithLabelValues(priority.String(), peer.Task.Type.String(),
peer.Task.Tag, peer.Task.Application, peer.Host.Type.Name()).Inc() peer.Task.Tag, peer.Task.Application, peer.Host.Type.Name()).Inc()
// TODO to be determined which traffic type to use, temporarily use TrafficType_REMOTE_PEER instead // TODO to be determined which traffic type to use, temporarily use TrafficType_REMOTE_PEER instead
metrics.DownloadPeerDuration.WithLabelValues(metrics.CalculateSizeLevel(peer.Task.ContentLength.Load()).String()).Observe(float64(peer.Cost.Load())) metrics.DownloadPeerDuration.WithLabelValues(metrics.CalculateSizeLevel(peer.Task.ContentLength.Load()).String()).Observe(float64(peer.Cost.Load().Milliseconds()))
return nil return nil
} }