Documentation ¶
Overview ¶
Package health is a registry for other packages to report & check overall health status of the node.
Index ¶
- Constants
- func DebugHandler(typ string) http.Handler
- func RegisterDebugHandler(typ string, h http.Handler)
- type ReceiveFunc
- type ReceiveFuncStats
- type Subsystem
- type Tracker
- func (t *Tracker) AppendWarnableDebugFlags(base []string) []string
- func (t *Tracker) AppendWarnings(dst []string) []string
- func (t *Tracker) DNSHealth() error
- func (t *Tracker) DNSOSHealth() error
- func (t *Tracker) GetDERPRegionReceivedTime(region int) time.Time
- func (t *Tracker) GetInPollNetMap() bool
- func (t *Tracker) GotStreamedMapResponse()
- func (t *Tracker) NoteDERPRegionReceivedFrame(region int)
- func (t *Tracker) NoteMapRequestHeard(mr *tailcfg.MapRequest)
- func (t *Tracker) OverallError() error
- func (t *Tracker) ReceiveFuncStats(which ReceiveFunc) *ReceiveFuncStats
- func (t *Tracker) RegisterWatcher(cb func(key Subsystem, err error)) (unregister func())
- func (t *Tracker) RouterHealth() error
- func (t *Tracker) SetAnyInterfaceUp(up bool)
- func (t *Tracker) SetAuthRoutineInError(err error)
- func (t *Tracker) SetCheckForUpdates(v bool)
- func (t *Tracker) SetControlHealth(problems []string)
- func (t *Tracker) SetDERPRegionConnectedState(region int, connected bool)
- func (t *Tracker) SetDERPRegionHealth(region int, problem string)
- func (t *Tracker) SetDNSHealth(err error)
- func (t *Tracker) SetDNSManagerHealth(err error)
- func (t *Tracker) SetDNSOSHealth(err error)
- func (t *Tracker) SetIPNState(state string, wantRunning bool)
- func (t *Tracker) SetLatestVersion(v *tailcfg.ClientVersion)
- func (t *Tracker) SetLocalLogConfigHealth(err error)
- func (t *Tracker) SetMagicSockDERPHome(region int, homeless bool)
- func (t *Tracker) SetOutOfPollNetMap()
- func (t *Tracker) SetRouterHealth(err error)
- func (t *Tracker) SetTKAHealth(err error)
- func (t *Tracker) SetTLSConnectionError(host string, err error)
- func (t *Tracker) SetUDP4Unbound(unbound bool)
- func (t *Tracker) SetWarnable(w *Warnable, err error)
- func (t *Tracker) TKAHealth() error
- type Warnable
- type WarnableOpt
Constants ¶
const ( // SysOverall is the name representing the overall health of // the system, rather than one particular subsystem. SysOverall = Subsystem("overall") // SysRouter is the name of the wgengine/router subsystem. SysRouter = Subsystem("router") // SysDNS is the name of the net/dns subsystem. SysDNS = Subsystem("dns") // SysDNSOS is the name of the net/dns OSConfigurator subsystem. SysDNSOS = Subsystem("dns-os") // SysDNSManager is the name of the net/dns manager subsystem. SysDNSManager = Subsystem("dns-manager") // SysTKA is the name of the tailnet key authority subsystem. SysTKA = Subsystem("tailnet-lock") )
Variables ¶
This section is empty.
Functions ¶
func DebugHandler ¶ added in v1.20.0
func RegisterDebugHandler ¶ added in v1.20.0
Types ¶
type ReceiveFunc ¶ added in v1.66.0
type ReceiveFunc int
ReceiveFunc is one of the three magicsock Receive funcs (IPv4, IPv6, or DERP).
const ( ReceiveIPv4 ReceiveFunc = 0 ReceiveIPv6 ReceiveFunc = 1 ReceiveDERP ReceiveFunc = 2 )
ReceiveFunc indices for Tracker.MagicSockReceiveFuncs.
func (ReceiveFunc) String ¶ added in v1.66.0
func (f ReceiveFunc) String() string
type ReceiveFuncStats ¶ added in v1.8.0
type ReceiveFuncStats struct {
// contains filtered or unexported fields
}
ReceiveFuncStats tracks the calls made to a wireguard-go receive func.
func (*ReceiveFuncStats) Enter ¶ added in v1.8.0
func (s *ReceiveFuncStats) Enter()
func (*ReceiveFuncStats) Exit ¶ added in v1.8.0
func (s *ReceiveFuncStats) Exit()
type Subsystem ¶ added in v1.6.0
type Subsystem string
Subsystem is the name of a subsystem whose health can be monitored.
type Tracker ¶ added in v1.66.0
type Tracker struct { // MagicSockReceiveFuncs tracks the state of the three // magicsock receive functions: IPv4, IPv6, and DERP. MagicSockReceiveFuncs [3]ReceiveFuncStats // indexed by ReceiveFunc values // contains filtered or unexported fields }
Tracker tracks the health of various Tailscale subsystems, comparing each subsystems' state with each other to make sure they're consistent based on the user's intended state.
func (*Tracker) AppendWarnableDebugFlags ¶ added in v1.66.0
AppendWarnableDebugFlags appends to base any health items that are currently in failed state and were created with MapDebugFlag.
func (*Tracker) AppendWarnings ¶ added in v1.66.0
AppendWarnings appends all current health warnings to dst and returns the result.
func (*Tracker) DNSOSHealth ¶ added in v1.66.0
DNSOSHealth returns the net/dns.OSConfigurator error state.
func (*Tracker) GetDERPRegionReceivedTime ¶ added in v1.66.0
GetDERPRegionReceivedTime returns the last time that a frame was received from the given DERP region, or the zero time if no communication with that region has occurred.
func (*Tracker) GetInPollNetMap ¶ added in v1.66.0
GetInPollNetMap reports whether the client has an open HTTP long poll open to the control plane.
func (*Tracker) GotStreamedMapResponse ¶ added in v1.66.0
func (t *Tracker) GotStreamedMapResponse()
GotStreamedMapResponse notes that we got a tailcfg.MapResponse message in streaming mode, even if it's just a keep-alive message.
This also notes that a map poll is in progress. To unset that, call SetOutOfPollNetMap().
func (*Tracker) NoteDERPRegionReceivedFrame ¶ added in v1.66.0
NoteDERPRegionReceivedFrame is called to note that a frame was received from the given DERP region at the current time.
func (*Tracker) NoteMapRequestHeard ¶ added in v1.66.0
func (t *Tracker) NoteMapRequestHeard(mr *tailcfg.MapRequest)
NoteMapRequestHeard notes whenever we successfully sent a map request to control for which we received a 200 response.
func (*Tracker) OverallError ¶ added in v1.66.0
OverallError returns a summary of the health state.
If there are multiple problems, the error will be of type multierr.Error.
func (*Tracker) ReceiveFuncStats ¶ added in v1.66.0
func (t *Tracker) ReceiveFuncStats(which ReceiveFunc) *ReceiveFuncStats
ReceiveFuncStats returns the ReceiveFuncStats tracker for the given func type.
If t is nil, it returns nil.
func (*Tracker) RegisterWatcher ¶ added in v1.66.0
RegisterWatcher adds a function that will be called if an error changes state either to unhealthy or from unhealthy. It is not called on transition from unknown to healthy. It must be non-nil and is run in its own goroutine. The returned func unregisters it.
func (*Tracker) RouterHealth ¶ added in v1.66.0
RouterHealth returns the wgengine/router.Router error state.
func (*Tracker) SetAnyInterfaceUp ¶ added in v1.66.0
SetAnyInterfaceUp sets whether any network interface is up.
func (*Tracker) SetAuthRoutineInError ¶ added in v1.66.0
SetAuthRoutineInError records the latest error encountered as a result of a login attempt. Providing a nil error indicates successful login, or that being logged in w/coordination is not currently desired.
func (*Tracker) SetCheckForUpdates ¶ added in v1.66.0
SetCheckForUpdates sets whether the client wants to check for updates.
func (*Tracker) SetControlHealth ¶ added in v1.66.0
func (*Tracker) SetDERPRegionConnectedState ¶ added in v1.66.0
func (*Tracker) SetDERPRegionHealth ¶ added in v1.66.0
SetDERPRegionHealth sets or clears any problem associated with the provided DERP region.
func (*Tracker) SetDNSHealth ¶ added in v1.66.0
SetDNSHealth sets the state of the net/dns.Manager
func (*Tracker) SetDNSManagerHealth ¶ added in v1.66.0
SetDNSManagerHealth sets the state of the Linux net/dns manager's discovery of the /etc/resolv.conf situation.
func (*Tracker) SetDNSOSHealth ¶ added in v1.66.0
SetDNSOSHealth sets the state of the net/dns.OSConfigurator
func (*Tracker) SetIPNState ¶ added in v1.66.0
state is an ipn.State.String() value: "Running", "Stopped", "NeedsLogin", etc.
func (*Tracker) SetLatestVersion ¶ added in v1.66.0
func (t *Tracker) SetLatestVersion(v *tailcfg.ClientVersion)
SetLatestVersion records the latest version of the Tailscale client. v can be nil if unknown.
func (*Tracker) SetLocalLogConfigHealth ¶ added in v1.66.0
SetLocalLogConfigHealth sets the error state of this client's local log configuration.
func (*Tracker) SetMagicSockDERPHome ¶ added in v1.66.0
SetMagicSockDERPHome notes what magicsock's view of its home DERP is.
The homeless parameter is whether magicsock is running in DERP-disconnected mode, without discovering and maintaining a connection to its home DERP.
func (*Tracker) SetOutOfPollNetMap ¶ added in v1.66.0
func (t *Tracker) SetOutOfPollNetMap()
SetOutOfPollNetMap records that the client is no longer in an HTTP map request long poll to the control plane.
func (*Tracker) SetRouterHealth ¶ added in v1.66.0
SetRouterHealth sets the state of the wgengine/router.Router.
func (*Tracker) SetTKAHealth ¶ added in v1.66.0
SetTKAHealth sets the health of the tailnet key authority.
func (*Tracker) SetTLSConnectionError ¶ added in v1.66.0
SetTLSConnectionError sets the error state for connections to a specific host. Setting the error to nil will clear any previously-set error.
func (*Tracker) SetUDP4Unbound ¶ added in v1.66.0
SetUDP4Unbound sets whether the udp4 bind failed completely.
func (*Tracker) SetWarnable ¶ added in v1.66.0
Set updates the Warnable's state. If non-nil, it's considered unhealthy.
type Warnable ¶ added in v1.34.0
type Warnable struct {
// contains filtered or unexported fields
}
Warnable is a health check item that may or may not be in a bad warning state. The caller of NewWarnable is responsible for calling Tracker.SetWarnable to update the state.
func NewWarnable ¶ added in v1.34.0
func NewWarnable(opts ...WarnableOpt) *Warnable
NewWarnable returns a new warnable item that the caller can mark as health or in warning state via Tracker.SetWarnable.
NewWarnable is generally called in init and stored in a package global. It can be used by multiple Trackers.
type WarnableOpt ¶ added in v1.34.0
type WarnableOpt interface {
// contains filtered or unexported methods
}
WarnableOpt is an option passed to NewWarnable.
func WithConnectivityImpact ¶ added in v1.62.0
func WithConnectivityImpact() WarnableOpt
WithConnectivityImpact returns an option which makes a Warnable annotated as something that could be breaking external network connectivity on the machine. This will make the warnable returned by OverallError alongside network connectivity errors.
func WithMapDebugFlag ¶ added in v1.34.0
func WithMapDebugFlag(name string) WarnableOpt
WithMapDebugFlag returns a WarnableOpt for NewWarnable that makes the returned Warnable report itself to the coordination server as broken with this string in MapRequest.DebugFlag when Set to a non-nil value.