cli/serve: funnel interactive enablement flow tweaks

1. Add metrics to funnel flow.
2. Stop blocking users from turning off funnels when no longer in
   their node capabilities.
3. Rename LocalClient.IncrementMetric to IncrementCounter to better
   callout its usage is only for counter clientmetrics.

Updates tailscale/corp#10577

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy
2023-08-15 00:07:51 -04:00
committed by Sonia Appasamy
parent 8e63d75018
commit 0052830c64
4 changed files with 27 additions and 13 deletions

View File

@ -259,13 +259,12 @@ func (lc *LocalClient) DaemonMetrics(ctx context.Context) ([]byte, error) {
return lc.get200(ctx, "/localapi/v0/metrics")
}
// IncrementMetric increments the value of a Tailscale daemon's metric by
// the given delta. If the metric has yet to exist, a new counter metric is
// created and initialized to delta.
// IncrementCounter increments the value of a Tailscale daemon's counter
// metric by the given delta. If the metric has yet to exist, a new counter
// metric is created and initialized to delta.
//
// IncrementMetric only supports counter metrics and non-negative delta values.
// Gauge metrics are unsupported.
func (lc *LocalClient) IncrementMetric(ctx context.Context, name string, delta int) error {
// IncrementCounter does not support gauge metrics or negative delta values.
func (lc *LocalClient) IncrementCounter(ctx context.Context, name string, delta int) error {
type metricUpdate struct {
Name string `json:"name"`
Type string `json:"type"`