ipn,log: add logger for sockstat deltas

Signed-off-by: Will Norris <will@tailscale.com>
Co-authored-by: Melanie Warrick <warrick@tailscale.com>
This commit is contained in:
Will Norris
2023-03-07 16:22:23 -08:00
committed by Will Norris
parent 5e8a80b845
commit a1d9f65354
8 changed files with 278 additions and 8 deletions
+5 -2
View File
@@ -19,6 +19,8 @@ import (
"tailscale.com/util/clientmetric"
)
const IsAvailable = true
type sockStatCounters struct {
txBytes, rxBytes atomic.Uint64
rxBytesByInterface, txBytesByInterface map[int]*atomic.Uint64
@@ -155,8 +157,9 @@ func get() *SockStats {
defer sockStats.mu.Unlock()
r := &SockStats{
Stats: make(map[Label]SockStat),
Interfaces: make([]string, 0, len(sockStats.usedInterfaces)),
Stats: make(map[Label]SockStat),
Interfaces: make([]string, 0, len(sockStats.usedInterfaces)),
CurrentInterfaceCellular: sockStats.currentInterfaceCellular.Load(),
}
for iface := range sockStats.usedInterfaces {
r.Interfaces = append(r.Interfaces, sockStats.knownInterfaces[iface])