fix: use uuid instead of peerID for reporting bandwidth (#3200)
This commit is contained in:
parent
e64091c779
commit
e998270856
|
@ -7,6 +7,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/libp2p/go-libp2p/core/metrics"
|
"github.com/libp2p/go-libp2p/core/metrics"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -18,11 +19,11 @@ type BandwidthTelemetryClient struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBandwidthTelemetryClient(logger *zap.Logger, serverURL string, hostID string) *BandwidthTelemetryClient {
|
func NewBandwidthTelemetryClient(logger *zap.Logger, serverURL string) *BandwidthTelemetryClient {
|
||||||
return &BandwidthTelemetryClient{
|
return &BandwidthTelemetryClient{
|
||||||
serverURL: serverURL,
|
serverURL: serverURL,
|
||||||
httpClient: &http.Client{Timeout: time.Minute},
|
httpClient: &http.Client{Timeout: time.Minute},
|
||||||
hostID: hostID,
|
hostID: uuid.NewString(),
|
||||||
logger: logger.Named("bandwidth-telemetry"),
|
logger: logger.Named("bandwidth-telemetry"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,7 +558,7 @@ func (w *Waku) telemetryBandwidthStats(telemetryServerURL string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
telemetry := NewBandwidthTelemetryClient(w.logger, telemetryServerURL, w.node.ID())
|
telemetry := NewBandwidthTelemetryClient(w.logger, telemetryServerURL)
|
||||||
|
|
||||||
ticker := time.NewTicker(time.Second * 20)
|
ticker := time.NewTicker(time.Second * 20)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
Loading…
Reference in New Issue