From a4b3df5a8cbcbcd8fcd0ab4ddf6c38ca00a83b4f Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 5 Sep 2023 18:33:50 +0800 Subject: [PATCH] statistics: add update metrics for stats cache (#46665) close pingcap/tidb#46577 --- statistics/handle/cache/statscacheinner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/statistics/handle/cache/statscacheinner.go b/statistics/handle/cache/statscacheinner.go index 6bb7e78ea8..09fbde7436 100644 --- a/statistics/handle/cache/statscacheinner.go +++ b/statistics/handle/cache/statscacheinner.go @@ -118,6 +118,7 @@ func (sc *StatsCache) Put(id int64, t *statistics.Table) { } func (sc *StatsCache) putCache(id int64, t *statistics.Table) bool { + metrics.UpdateCounter.Inc() ok := sc.c.Put(id, t) if ok { return ok @@ -202,9 +203,11 @@ func (sc *StatsCache) Update(tables []*statistics.Table, deletedIDs []int64, opt } for _, tbl := range tables { id := tbl.PhysicalID + metrics.UpdateCounter.Inc() sc.c.Put(id, tbl) } for _, id := range deletedIDs { + metrics.DelCounter.Inc() sc.c.Del(id) }