mirror of https://github.com/coder/coder.git
chore: add logging to nodeUpdater (#11569)
Add debug logging for nodeUpdater and configMaps
This commit is contained in:
parent
bad2ce562e
commit
2aa3cbbd03
|
@ -137,6 +137,7 @@ func (c *configMaps) configLoop() {
|
||||||
c.Wait()
|
c.Wait()
|
||||||
}
|
}
|
||||||
if c.closing {
|
if c.closing {
|
||||||
|
c.logger.Debug(context.Background(), "closing configMaps configLoop")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// queue up the reconfiguration actions we will take while we have
|
// queue up the reconfiguration actions we will take while we have
|
||||||
|
@ -146,12 +147,14 @@ func (c *configMaps) configLoop() {
|
||||||
if c.derpMapDirty {
|
if c.derpMapDirty {
|
||||||
derpMap := c.derpMapLocked()
|
derpMap := c.derpMapLocked()
|
||||||
actions = append(actions, func() {
|
actions = append(actions, func() {
|
||||||
|
c.logger.Debug(context.Background(), "updating engine DERP map", slog.F("derp_map", derpMap))
|
||||||
c.engine.SetDERPMap(derpMap)
|
c.engine.SetDERPMap(derpMap)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if c.netmapDirty {
|
if c.netmapDirty {
|
||||||
nm := c.netMapLocked()
|
nm := c.netMapLocked()
|
||||||
actions = append(actions, func() {
|
actions = append(actions, func() {
|
||||||
|
c.logger.Debug(context.Background(), "updating engine network map", slog.F("network_map", nm))
|
||||||
c.engine.SetNetworkMap(nm)
|
c.engine.SetNetworkMap(nm)
|
||||||
c.reconfig(nm)
|
c.reconfig(nm)
|
||||||
})
|
})
|
||||||
|
@ -159,6 +162,7 @@ func (c *configMaps) configLoop() {
|
||||||
if c.filterDirty {
|
if c.filterDirty {
|
||||||
f := c.filterLocked()
|
f := c.filterLocked()
|
||||||
actions = append(actions, func() {
|
actions = append(actions, func() {
|
||||||
|
c.logger.Debug(context.Background(), "updating engine filter", slog.F("filter", f))
|
||||||
c.engine.SetFilter(f)
|
c.engine.SetFilter(f)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ func (u *nodeUpdater) updateLoop() {
|
||||||
u.Wait()
|
u.Wait()
|
||||||
}
|
}
|
||||||
if u.closing {
|
if u.closing {
|
||||||
|
u.logger.Debug(context.Background(), "closing nodeUpdater updateLoop")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
node := u.nodeLocked()
|
node := u.nodeLocked()
|
||||||
|
@ -68,6 +69,7 @@ func (u *nodeUpdater) updateLoop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
u.L.Unlock()
|
u.L.Unlock()
|
||||||
|
u.logger.Debug(context.Background(), "calling nodeUpdater callback", slog.F("node", node))
|
||||||
u.callback(node)
|
u.callback(node)
|
||||||
u.L.Lock()
|
u.L.Lock()
|
||||||
}
|
}
|
||||||
|
@ -126,6 +128,8 @@ func (u *nodeUpdater) setNetInfo(ni *tailcfg.NetInfo) {
|
||||||
if u.preferredDERP != ni.PreferredDERP {
|
if u.preferredDERP != ni.PreferredDERP {
|
||||||
dirty = true
|
dirty = true
|
||||||
u.preferredDERP = ni.PreferredDERP
|
u.preferredDERP = ni.PreferredDERP
|
||||||
|
u.logger.Debug(context.Background(), "new preferred DERP",
|
||||||
|
slog.F("preferred_derp", u.preferredDERP))
|
||||||
}
|
}
|
||||||
if !maps.Equal(u.derpLatency, ni.DERPLatency) {
|
if !maps.Equal(u.derpLatency, ni.DERPLatency) {
|
||||||
dirty = true
|
dirty = true
|
||||||
|
|
Loading…
Reference in New Issue