From 2a8f1e6931648ac95fda0d0b3a5858d3dcb40c30 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 16 May 2020 10:21:17 +0300 Subject: [PATCH] lib/storage: do not increment `vm_slow_metric_name_loads_total` counter for metric_ids which shouldnt be prefetched, since this may mislead users --- lib/storage/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/storage/storage.go b/lib/storage/storage.go index 2d855691f8..d4f03a4213 100644 --- a/lib/storage/storage.go +++ b/lib/storage/storage.go @@ -877,11 +877,11 @@ func (s *Storage) prefetchMetricNames(tsids []TSID) error { metricIDs = append(metricIDs, metricID) tsidsMap[metricID] = &tsids[i] } - atomic.AddUint64(&s.slowMetricNameLoads, uint64(len(metricIDs))) if len(metricIDs) < 500 { // It is cheaper to skip pre-fetching and obtain metricNames inline. return nil } + atomic.AddUint64(&s.slowMetricNameLoads, uint64(len(metricIDs))) // Pre-fetch metricIDs. sort.Sort(metricIDs)