mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
cmd/checkmetrics: add command for checking metrics against kb
This commit adds a command to validate that all the metrics that are registring in the client are also present in a path or url. It is intended to be ran from the KB against the latest version of tailscale. Updates tailscale/corp#24066 Updates tailscale/corp#22075 Co-Authored-By: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:

committed by
Kristoffer Dalby

parent
13faa64c14
commit
a68efe2088
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"tailscale.com/metrics"
|
||||
"tailscale.com/tsweb/varz"
|
||||
"tailscale.com/util/set"
|
||||
)
|
||||
|
||||
// Registry tracks user-facing metrics of various Tailscale subsystems.
|
||||
@@ -106,3 +107,13 @@ func (r *Registry) String() string {
|
||||
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
// Metrics returns the name of all the metrics in the registry.
|
||||
func (r *Registry) MetricNames() []string {
|
||||
ret := make(set.Set[string])
|
||||
r.vars.Do(func(kv expvar.KeyValue) {
|
||||
ret.Add(kv.Key)
|
||||
})
|
||||
|
||||
return ret.Slice()
|
||||
}
|
||||
|
Reference in New Issue
Block a user