mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
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:
@@ -18,8 +18,9 @@ import (
|
||||
// WithSockStats() function, along with the interfaces that we have
|
||||
// per-interface statistics for.
|
||||
type SockStats struct {
|
||||
Stats map[Label]SockStat
|
||||
Interfaces []string
|
||||
Stats map[Label]SockStat
|
||||
Interfaces []string
|
||||
CurrentInterfaceCellular bool
|
||||
}
|
||||
|
||||
// SockStat contains the sent and received bytes for a socket instrumented with
|
||||
|
@@ -9,6 +9,8 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const IsAvailable = false
|
||||
|
||||
func withSockStats(ctx context.Context, label Label) context.Context {
|
||||
return ctx
|
||||
}
|
||||
|
@@ -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])
|
||||
|
Reference in New Issue
Block a user