1b5b43787c
Add a new "ipnbus" build feature tag so the watch-ipn-bus LocalAPI endpoint can be independently controlled, rather than being gated behind HasDebug || HasServe. Minimal/embedded builds that omit both debug and serve were getting 404s on watch-ipn-bus, breaking "tailscale up --authkey=..." and other CLI flows that depend on WatchIPNBus. In the CLI, check buildfeatures.HasIPNBus before attempting to watch the IPN bus in "tailscale up"/"tailscale login", and exit early with an informational message when the feature is omitted. Also add the missing NewCounterFunc stub to clientmetric/omit.go, which caused compilation errors when building with ts_omit_clientmetrics and netstack enabled. Fixes #19240 Change-Id: I2e3c69a72fc50fa02542b91b8a54859618a463d1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
33 lines
1012 B
Go
33 lines
1012 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// 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 }
|
|
func NewCounterFunc(string, func() int64) *Metric { return &zeroMetric }
|