|
|
@ -16,6 +16,7 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"tailscale.com/net/interfaces"
|
|
|
|
"tailscale.com/net/interfaces"
|
|
|
|
"tailscale.com/types/logger"
|
|
|
|
"tailscale.com/types/logger"
|
|
|
|
|
|
|
|
"tailscale.com/util/clientmetric"
|
|
|
|
"tailscale.com/util/set"
|
|
|
|
"tailscale.com/util/set"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -369,6 +370,13 @@ func (m *Monitor) debounce() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
|
|
|
metricChangeEq = clientmetric.NewCounter("netmon_link_change_eq")
|
|
|
|
|
|
|
|
metricChange = clientmetric.NewCounter("netmon_link_change")
|
|
|
|
|
|
|
|
metricChangeTimeJump = clientmetric.NewCounter("netmon_link_change_timejump")
|
|
|
|
|
|
|
|
metricChangeMajor = clientmetric.NewCounter("netmon_link_change_major")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// handlePotentialChange considers whether newState is different enough to wake
|
|
|
|
// handlePotentialChange considers whether newState is different enough to wake
|
|
|
|
// up callers and updates the monitor's state if so.
|
|
|
|
// up callers and updates the monitor's state if so.
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -380,6 +388,7 @@ func (m *Monitor) handlePotentialChange(newState *interfaces.State, forceCallbac
|
|
|
|
timeJumped := shouldMonitorTimeJump && m.checkWallTimeAdvanceLocked()
|
|
|
|
timeJumped := shouldMonitorTimeJump && m.checkWallTimeAdvanceLocked()
|
|
|
|
if !timeJumped && !forceCallbacks && oldState.Equal(newState) {
|
|
|
|
if !timeJumped && !forceCallbacks && oldState.Equal(newState) {
|
|
|
|
// Exactly equal. Nothing to do.
|
|
|
|
// Exactly equal. Nothing to do.
|
|
|
|
|
|
|
|
metricChangeEq.Add(1)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -410,6 +419,13 @@ func (m *Monitor) handlePotentialChange(newState *interfaces.State, forceCallbac
|
|
|
|
delta.Major = true
|
|
|
|
delta.Major = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
metricChange.Add(1)
|
|
|
|
|
|
|
|
if delta.Major {
|
|
|
|
|
|
|
|
metricChangeMajor.Add(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if delta.TimeJumped {
|
|
|
|
|
|
|
|
metricChangeTimeJump.Add(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
for _, cb := range m.cbs {
|
|
|
|
for _, cb := range m.cbs {
|
|
|
|
go cb(delta)
|
|
|
|
go cb(delta)
|
|
|
|
}
|
|
|
|
}
|
|
|
|