mirror of
https://github.com/tailscale/tailscale.git
synced 2026-04-21 13:32:15 +02:00
Add an opt-in metrics.LabelMap tracking why patchifyPeer fails to
convert a PeersChanged entry into a PeersChangedPatch. The stats are
gated behind the TS_DEBUG_PATCHIFY_PEER_MISS envknob so there is zero
overhead in normal operation.
peerChangeDiff now takes an optional onFalse callback that is called
with the field name on every non-patchable return path. When the
envknob is off, nil is passed and replaced with a no-op at the top of
peerChangeDiff.
The resulting metric renders as:
counter_patchify_miss{why="Hostinfo"} 2
counter_patchify_miss{why="peer_not_found"} 1170
Updates tailscale/corp#40088
Change-Id: I2d4b9074bf42ec03ab296c0629a54106bafa873e
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
17 lines
344 B
Go
17 lines
344 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !ts_omit_debug
|
|
|
|
package controlclient
|
|
|
|
import "tailscale.com/metrics"
|
|
|
|
var patchifyMissStats = metrics.NewLabelMap("counter_patchify_miss", "why")
|
|
|
|
func init() {
|
|
patchifyMissOnFalse = func(field string) {
|
|
patchifyMissStats.Add(field, 1)
|
|
}
|
|
}
|