mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 11:11:18 -08:00
util/usermetric: add empty label helper
Signed-off-by: Kristoffer Dalby <[email protected]>
This commit is contained in:
1 file changed
+15
@@ -33,6 +33,21 @@ func NewMultiLabelMap[T comparable](name string, promType, helpText string) *met
|
||||
return m
|
||||
}
|
||||
|
||||
// NewMap creates and register a new
|
||||
// Map variable with the given name and returns it.
|
||||
//
|
||||
// Note that usermetric are not protected against duplicate
|
||||
// metrics name. It is the caller's responsibility to ensure that
|
||||
// the name is unique.
|
||||
func NewMap(name string, promType, helpText string) *metrics.MultiLabelMap[struct{}] {
|
||||
m := &metrics.MultiLabelMap[struct{}]{
|
||||
Type: promType,
|
||||
Help: helpText,
|
||||
}
|
||||
vars.Set(name, m)
|
||||
return m
|
||||
}
|
||||
|
||||
// Handler returns a varz.Handler that serves the userfacing expvar contained
|
||||
// in this package.
|
||||
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in new issue
Block a user