mirror of
https://github.com/status-im/status-go.git
synced 2025-01-21 04:01:45 +00:00
fix: reset bandwidth stats totals every day, and send message size
This commit is contained in:
parent
ab2ff4eeb1
commit
dc4c1a61b1
@ -46,6 +46,7 @@ func (c *Client) PushReceivedMessages(filter transport.Filter, sshMessage *types
|
||||
"messageType": message.Type.String(),
|
||||
"receiverKeyUID": c.keyUID,
|
||||
"nodeName": c.nodeName,
|
||||
"messageSize": len(sshMessage.Payload),
|
||||
})
|
||||
}
|
||||
body, _ := json.Marshal(postBody)
|
||||
|
@ -563,11 +563,19 @@ func (w *Waku) telemetryBandwidthStats(telemetryServerURL string) {
|
||||
ticker := time.NewTicker(time.Second * 20)
|
||||
defer ticker.Stop()
|
||||
|
||||
today := time.Now()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-w.quit:
|
||||
return
|
||||
case <-ticker.C:
|
||||
case now := <-ticker.C:
|
||||
// Reset totals when day changes
|
||||
if now.Day() != today.Day() {
|
||||
today = now
|
||||
w.bandwidthCounter.Reset()
|
||||
}
|
||||
|
||||
storeStats := w.bandwidthCounter.GetBandwidthForProtocol(store.StoreID_v20beta4)
|
||||
relayStats := w.bandwidthCounter.GetBandwidthForProtocol(relay.WakuRelayID_v200)
|
||||
go telemetry.PushProtocolStats(relayStats, storeStats)
|
||||
|
Loading…
x
Reference in New Issue
Block a user