fix: use uuid instead of peerID for reporting bandwidth (#3200)

This commit is contained in:
RichΛrd 2023-02-17 09:15:28 -04:00 committed by GitHub
parent e64091c779
commit e998270856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import (
"net/http"
"time"
"github.com/google/uuid"
"github.com/libp2p/go-libp2p/core/metrics"
"go.uber.org/zap"
)
@ -18,11 +19,11 @@ type BandwidthTelemetryClient struct {
logger *zap.Logger
}
func NewBandwidthTelemetryClient(logger *zap.Logger, serverURL string, hostID string) *BandwidthTelemetryClient {
func NewBandwidthTelemetryClient(logger *zap.Logger, serverURL string) *BandwidthTelemetryClient {
return &BandwidthTelemetryClient{
serverURL: serverURL,
httpClient: &http.Client{Timeout: time.Minute},
hostID: hostID,
hostID: uuid.NewString(),
logger: logger.Named("bandwidth-telemetry"),
}
}

View File

@ -558,7 +558,7 @@ func (w *Waku) telemetryBandwidthStats(telemetryServerURL string) {
return
}
telemetry := NewBandwidthTelemetryClient(w.logger, telemetryServerURL, w.node.ID())
telemetry := NewBandwidthTelemetryClient(w.logger, telemetryServerURL)
ticker := time.NewTicker(time.Second * 20)
defer ticker.Stop()