mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +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"
|
"cmp"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"expvar"
|
||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
"net"
|
"net"
|
||||||
@ -22,6 +23,7 @@
|
|||||||
xmaps "golang.org/x/exp/maps"
|
xmaps "golang.org/x/exp/maps"
|
||||||
"tailscale.com/control/controlknobs"
|
"tailscale.com/control/controlknobs"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
|
"tailscale.com/metrics"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tstime"
|
"tailscale.com/tstime"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
@ -344,6 +346,9 @@ func (ms *mapSession) updateStateFromResponse(resp *tailcfg.MapResponse) {
|
|||||||
}
|
}
|
||||||
if resp.Health != nil {
|
if resp.Health != nil {
|
||||||
ms.lastHealth = resp.Health
|
ms.lastHealth = resp.Health
|
||||||
|
warnings := expvar.Int{}
|
||||||
|
warnings.Set(int64(len(resp.Health)))
|
||||||
|
metricHealthMessages.Set(healthMessageLabel{Severity: "warning"}, &warnings)
|
||||||
}
|
}
|
||||||
if resp.TKAInfo != nil {
|
if resp.TKAInfo != nil {
|
||||||
ms.lastTKAInfo = resp.TKAInfo
|
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 (
|
var (
|
||||||
patchDERPRegion = clientmetric.NewCounter("controlclient_patch_derp")
|
patchDERPRegion = clientmetric.NewCounter("controlclient_patch_derp")
|
||||||
patchEndpoints = clientmetric.NewCounter("controlclient_patch_endpoints")
|
patchEndpoints = clientmetric.NewCounter("controlclient_patch_endpoints")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user