diff --git a/cache/disk/disk_test.go b/cache/disk/disk_test.go index ae6b1615e..20b35e81a 100644 --- a/cache/disk/disk_test.go +++ b/cache/disk/disk_test.go @@ -1263,8 +1263,8 @@ func TestMetricsUnvalidatedAC(t *testing.T) { } acHits := count(testCache.counter, acKind, hitStatus) - if acHits != 1 { - t.Fatalf("Expected acHit counter to be 1, found %f", acHits) + if acHits != 0 { + t.Fatalf("Expected acHit counter to be 0, found %f", acHits) } acMiss := count(testCache.counter, acKind, missStatus) @@ -1301,8 +1301,8 @@ func TestMetricsUnvalidatedAC(t *testing.T) { } acHits = count(testCache.counter, acKind, hitStatus) - if acHits != 2 { - t.Fatalf("Expected acHit counter to be 2, found %f", acHits) + if acHits != 1 { + t.Fatalf("Expected acHit counter to be 1, found %f", acHits) } acMiss = count(testCache.counter, acKind, missStatus) if acMiss != 0 { diff --git a/cache/disk/metrics.go b/cache/disk/metrics.go index ee008bae0..ba536d84c 100644 --- a/cache/disk/metrics.go +++ b/cache/disk/metrics.go @@ -95,54 +95,6 @@ func (m *metricsDecorator) GetZstd(ctx context.Context, hash string, size int64, return rc, size, nil } -func (m *metricsDecorator) Contains(ctx context.Context, kind cache.EntryKind, hash string, size int64) (bool, int64) { - ok, size := m.diskCache.Contains(ctx, kind, hash, size) - - lbls := prometheus.Labels{"method": containsMethod, "kind": kind.String()} - if ok { - lbls["status"] = hitStatus - } else { - lbls["status"] = missStatus - } - m.addCategoryLabels(ctx, lbls) - m.counter.With(lbls).Inc() - - return ok, size -} - -func (m *metricsDecorator) FindMissingCasBlobs(ctx context.Context, blobs []*pb.Digest) ([]*pb.Digest, error) { - numLooking := len(blobs) - digests, err := m.diskCache.FindMissingCasBlobs(ctx, blobs) - if err != nil { - return digests, err - } - - numMissing := len(digests) - - numFound := numLooking - numMissing - - hitLabels := prometheus.Labels{ - "method": containsMethod, - "kind": "cas", - "status": hitStatus, - } - m.addCategoryLabels(ctx, hitLabels) - hits := m.counter.With(hitLabels) - - missLabels := prometheus.Labels{ - "method": containsMethod, - "kind": "cas", - "status": missStatus, - } - m.addCategoryLabels(ctx, missLabels) - misses := m.counter.With(missLabels) - - hits.Add(float64(numFound)) - misses.Add(float64(numMissing)) - - return digests, nil -} - func (m *metricsDecorator) Put(ctx context.Context, kind cache.EntryKind, hash string, size int64, r io.Reader) error { err := m.diskCache.Put(ctx, kind, hash, size, r) if err != nil {