ops: Signal disk-full and eviction capacity pressure
When the disk (or memory) tier is at cap or the volume returns ENOSPC, ops currently look like random misses with no clear "we are dropping data." Count those events as capacity_pressure_events on /metrics and log tier plus reason so operators can tell capacity pressure from a cold cache, without changing the existing evictions counter. Link: #36
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"s1d3sw1ped/steamcache2/steamcache/metrics"
|
||||
)
|
||||
|
||||
func TestMemoryFS_Basic(t *testing.T) {
|
||||
@@ -60,6 +62,8 @@ func TestMemoryFS_EvictUnderPressure(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
met := metrics.NewMetrics()
|
||||
m.SetMetrics(met)
|
||||
// create 3x200 = 600 >500, should trigger internal? but direct evict call
|
||||
for i := 0; i < 3; i++ {
|
||||
w, _ := m.Create("f"+string(rune('0'+i)), 200)
|
||||
@@ -71,6 +75,13 @@ func TestMemoryFS_EvictUnderPressure(t *testing.T) {
|
||||
if evicted == 0 || m.Size() > 500 {
|
||||
t.Errorf("evict failed: evicted=%d size=%d", evicted, m.Size())
|
||||
}
|
||||
st := met.GetStats()
|
||||
if st.Evictions == 0 {
|
||||
t.Error("evictions counter not incremented under memory cap pressure")
|
||||
}
|
||||
if st.CapacityPressureEvents == 0 {
|
||||
t.Error("capacity_pressure_events not incremented under memory cap pressure")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMemoryFS_SizeNeverExceedsAfterEvict(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user