agent/cache: send the total entries count on eviction to go-metrics

pull/4275/head
Mitchell Hashimoto 2018-04-19 18:40:12 -07:00
parent e0d964188c
commit 194b256861
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 4 additions and 2 deletions

View File

@ -471,9 +471,11 @@ func (c *Cache) runExpiryLoop() {
// have it treated as a new value so that the TTL is extended. // have it treated as a new value so that the TTL is extended.
entry.HeapIndex = -1 entry.HeapIndex = -1
c.entriesLock.Unlock() // Set some metrics
metrics.IncrCounter([]string{"consul", "cache", "evict_expired"}, 1) metrics.IncrCounter([]string{"consul", "cache", "evict_expired"}, 1)
metrics.SetGauge([]string{"consul", "cache", "entries_count"}, float32(len(c.entries)))
c.entriesLock.Unlock()
} }
} }
} }