mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-31 00:03:47 +00:00
attempting to make healthv2 warnables work better
This commit is contained in:
parent
5a9259553a
commit
07b98db2bc
@ -1614,6 +1614,10 @@ func postPingResult(start time.Time, logf logger.Logf, c *http.Client, pr *tailc
|
|||||||
// ReportHealthChange reports to the control plane a change to this node's
|
// ReportHealthChange reports to the control plane a change to this node's
|
||||||
// health. w must be non-nil. us can be nil to indicate a healthy state for w.
|
// health. w must be non-nil. us can be nil to indicate a healthy state for w.
|
||||||
func (c *Direct) ReportHealthChange(w *health.Warnable, us *health.UnhealthyState) {
|
func (c *Direct) ReportHealthChange(w *health.Warnable, us *health.UnhealthyState) {
|
||||||
|
// TODO: Don't tell control about health messages that came from control?
|
||||||
|
if w == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if w == health.NetworkStatusWarnable || w == health.IPNStateWarnable || w == health.LoginStateWarnable {
|
if w == health.NetworkStatusWarnable || w == health.IPNStateWarnable || w == health.LoginStateWarnable {
|
||||||
// We don't report these. These include things like the network is down
|
// We don't report these. These include things like the network is down
|
||||||
// (in which case we can't report anyway) or the user wanted things
|
// (in which case we can't report anyway) or the user wanted things
|
||||||
|
@ -1151,20 +1151,15 @@ func (t *Tracker) updateBuiltinWarnablesLocked() {
|
|||||||
t.setHealthyLocked(derpRegionErrorWarnable)
|
t.setHealthyLocked(derpRegionErrorWarnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(t.controlHealth) > 0 {
|
if t.controlHealth != nil {
|
||||||
for _, s := range t.controlHealth {
|
// for _, cb := range t.watchers {
|
||||||
t.setUnhealthyLocked(&Warnable{
|
// go cb(nil, nil)
|
||||||
Code: WarnableCode(s.ID),
|
// }
|
||||||
Title: s.Title,
|
if len(t.controlHealth) > 0 {
|
||||||
Text: func(args Args) string {
|
t.setUnhealthyLocked(controlHealthWarnable, nil)
|
||||||
return s.Text
|
} else {
|
||||||
},
|
t.setHealthyLocked(controlHealthWarnable)
|
||||||
Severity: SeverityHigh,
|
|
||||||
ImpactsConnectivity: s.ImpactsConnectivity,
|
|
||||||
}, nil)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
t.setHealthyLocked(controlHealthWarnable)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := envknob.ApplyDiskConfigError(); err != nil {
|
if err := envknob.ApplyDiskConfigError(); err != nil {
|
||||||
|
@ -100,6 +100,17 @@ func (t *Tracker) CurrentState() *State {
|
|||||||
wm[w.Code] = *w.unhealthyState(ws)
|
wm[w.Code] = *w.unhealthyState(ws)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, h := range t.controlHealth {
|
||||||
|
wm[WarnableCode(h.ID)] = UnhealthyState{
|
||||||
|
WarnableCode: WarnableCode(h.ID),
|
||||||
|
Severity: SeverityHigh,
|
||||||
|
Title: h.Title,
|
||||||
|
Text: h.Text,
|
||||||
|
ImpactsConnectivity: h.ImpactsConnectivity,
|
||||||
|
URL: h.URL,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &State{
|
return &State{
|
||||||
Warnings: wm,
|
Warnings: wm,
|
||||||
}
|
}
|
||||||
|
@ -968,6 +968,9 @@ func (b *LocalBackend) linkChange(delta *netmon.ChangeDelta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) onHealthChange(w *health.Warnable, us *health.UnhealthyState) {
|
func (b *LocalBackend) onHealthChange(w *health.Warnable, us *health.UnhealthyState) {
|
||||||
|
if w == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if us == nil {
|
if us == nil {
|
||||||
b.logf("health(warnable=%s): ok", w.Code)
|
b.logf("health(warnable=%s): ok", w.Code)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user