From 7efcd3f0b066ea0de92d7a9e2a96bd24da033661 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:22:48 +0300 Subject: [PATCH] collect metric results so that probe latecy can be reported in /debug/metrics Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/tabletserver/throttle/throttler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go/vt/vttablet/tabletserver/throttle/throttler.go b/go/vt/vttablet/tabletserver/throttle/throttler.go index e5dd38d921d..6c58d388666 100644 --- a/go/vt/vttablet/tabletserver/throttle/throttler.go +++ b/go/vt/vttablet/tabletserver/throttle/throttler.go @@ -932,7 +932,7 @@ func (throttler *Throttler) generateTabletProbeFunction(scope base.Scope, tmClie // readSelfThrottleMetricsInternal rreads all registsred self metrics on this tablet (or backend MySQL server). // This is the actual place where metrics are read, to be later aggregated and/or propagated to other tablets. func (throttler *Throttler) readSelfThrottleMetricsInternal(ctx context.Context) base.ThrottleMetrics { - + result := make(base.ThrottleMetrics) writeMetric := func(metric *base.ThrottleMetric) { select { case <-ctx.Done(): @@ -960,8 +960,9 @@ func (throttler *Throttler) readSelfThrottleMetricsInternal(ctx context.Context) metric.Alias = throttler.tabletAlias go writeMetric(metric) + result[metricName] = metric } - return nil + return result } func (throttler *Throttler) collectSelfMetrics(ctx context.Context) {