From e9982708567f9df107cb8e8e6a8c001e610cfb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rich=CE=9Brd?= Date: Fri, 17 Feb 2023 09:15:28 -0400 Subject: [PATCH] fix: use uuid instead of peerID for reporting bandwidth (#3200) --- wakuv2/telemetry.go | 5 +++-- wakuv2/waku.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wakuv2/telemetry.go b/wakuv2/telemetry.go index 63dc5915a..88eaaea52 100644 --- a/wakuv2/telemetry.go +++ b/wakuv2/telemetry.go @@ -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"), } } diff --git a/wakuv2/waku.go b/wakuv2/waku.go index 59a7a1d66..b4250d3a2 100644 --- a/wakuv2/waku.go +++ b/wakuv2/waku.go @@ -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()