mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 16:17:41 +00:00
control/controlclient: add metric for health messages
Updates tailscale/corp#22075 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
1952888785
commit
3db0af4e61
@ -7,6 +7,7 @@
|
||||
"cmp"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"expvar"
|
||||
"fmt"
|
||||
"maps"
|
||||
"net"
|
||||
@ -22,6 +23,7 @@
|
||||
xmaps "golang.org/x/exp/maps"
|
||||
"tailscale.com/control/controlknobs"
|
||||
"tailscale.com/envknob"
|
||||
"tailscale.com/metrics"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/tstime"
|
||||
"tailscale.com/types/key"
|
||||
@ -344,6 +346,9 @@ func (ms *mapSession) updateStateFromResponse(resp *tailcfg.MapResponse) {
|
||||
}
|
||||
if resp.Health != nil {
|
||||
ms.lastHealth = resp.Health
|
||||
warnings := expvar.Int{}
|
||||
warnings.Set(int64(len(resp.Health)))
|
||||
metricHealthMessages.Set(healthMessageLabel{Severity: "warning"}, &warnings)
|
||||
}
|
||||
if resp.TKAInfo != nil {
|
||||
ms.lastTKAInfo = resp.TKAInfo
|
||||
@ -353,6 +358,16 @@ func (ms *mapSession) updateStateFromResponse(resp *tailcfg.MapResponse) {
|
||||
}
|
||||
}
|
||||
|
||||
type healthMessageLabel struct {
|
||||
Severity string
|
||||
}
|
||||
|
||||
var metricHealthMessages = metrics.NewMultiLabelMap[healthMessageLabel](
|
||||
"tailscaled_health_messages",
|
||||
"gauge",
|
||||
"A gauge of health messages from control, by severity",
|
||||
)
|
||||
|
||||
var (
|
||||
patchDERPRegion = clientmetric.NewCounter("controlclient_patch_derp")
|
||||
patchEndpoints = clientmetric.NewCounter("controlclient_patch_endpoints")
|
||||
|
Loading…
x
Reference in New Issue
Block a user