mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 00:56:20 +00:00
The existing client metric methods only support incrementing (or decrementing) a delta value. This new method allows setting the metric to a specific value. Updates tailscale/corp#35327 Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
32 lines
907 B
Go
32 lines
907 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build ts_omit_clientmetrics
|
|
|
|
package clientmetric
|
|
|
|
type Metric struct{}
|
|
|
|
func (*Metric) Add(int64) {}
|
|
func (*Metric) Set(int64) {}
|
|
func (*Metric) Value() int64 { return 0 }
|
|
func (*Metric) Register(expvarInt any) {}
|
|
func (*Metric) UnregisterAll() {}
|
|
|
|
type MetricUpdate struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Value int `json:"value"`
|
|
Op string `json:"op"`
|
|
}
|
|
|
|
func HasPublished(string) bool { panic("unreachable") }
|
|
func EncodeLogTailMetricsDelta() string { return "" }
|
|
func WritePrometheusExpositionFormat(any) {}
|
|
|
|
var zeroMetric Metric
|
|
|
|
func NewCounter(string) *Metric { return &zeroMetric }
|
|
func NewGauge(string) *Metric { return &zeroMetric }
|
|
func NewAggregateCounter(string) *Metric { return &zeroMetric }
|