Skip to content

Commit 2f26576

Browse files
committed
process cache: metric for implicit evictions
There are two types of evictions happening in the process cache: 1. Explicit, i.e., by removing a key 2. Capacity / Implicit, i.e., by running out of entries when we add a key The metric that Tetragon currently exports includes both. This commit adds a new metric for the capacity evictions only. Signed-off-by: Kornilios Kourtis <[email protected]>
1 parent c78811b commit 2f26576

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

docs/content/en/docs/reference/metrics.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/process/cache.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ func (pc *Cache) add(process *ProcessInternal) bool {
178178
evicted := pc.cache.Add(process.process.ExecId, process)
179179
if !evicted {
180180
processCacheTotal.Inc()
181+
} else {
182+
processCacheCapacityEvictions.Inc()
181183
}
182184
return evicted
183185
}

pkg/process/metrics.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ var (
3232
processCacheEvictions = prometheus.NewCounter(prometheus.CounterOpts{
3333
Namespace: consts.MetricsNamespace,
3434
Name: "process_cache_evictions_total",
35-
Help: "Number of process cache LRU evictions.",
35+
Help: "Number of process cache LRU evictions. This includes all evictions: both explicit and capacity (implicit).",
36+
})
37+
processCacheCapacityEvictions = prometheus.NewCounter(prometheus.CounterOpts{
38+
Namespace: consts.MetricsNamespace,
39+
Name: "process_cache_capacity_evictions_total",
40+
Help: "Number of process cache capacity (implicit) LRU evictions.",
3641
})
3742
processCacheMisses = metrics.MustNewCounter(metrics.NewOpts(
3843
consts.MetricsNamespace, "", "process_cache_misses_total",

0 commit comments

Comments
 (0)