cmd/derper,derp: add metrics for rate limit hits (#19560)

Expvars track count of rate limiters exceeding their threshold.
Covers (1) global rate limiter and (2) total of local rate limiters.

Also publish optional rate-limit metrics during ExpVar() call
if -rate-config is specified. Fixes current rate-limit metrics
being published outside of "derp" in /debug/vars.

Updates tailscale/corp#38509

Change-Id: Ic7f5a1e890d0d7d3d7b679daa4b5f8926a6a6964
Signed-off-by: Alex Valiushko <alexvaliushko@tailscale.com>
This commit is contained in:
Alex Valiushko
2026-04-29 10:29:09 -07:00
committed by GitHub
parent be7cce74ba
commit 01d0bdd253
4 changed files with 162 additions and 32 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ func main() {
if err := startMesh(s); err != nil {
log.Fatalf("startMesh: %v", err)
}
expvar.Publish("derp", s.ExpVar())
expvar.Publish("derp", s.ExpVar(*rateConfigPath != ""))
handleHome, ok := getHomeHandler(*flagHome)
if !ok {