Merge "veyron/runtimes/google/ipc: Modify collection of stats to more accurating collect blessings cache hit information."
diff --git a/runtimes/google/ipc/blessings_cache.go b/runtimes/google/ipc/blessings_cache.go
index 119c3db..aadbbfc 100644
--- a/runtimes/google/ipc/blessings_cache.go
+++ b/runtimes/google/ipc/blessings_cache.go
@@ -149,6 +149,8 @@
stats.recordBlessingCache(true)
return cached, nil
}
+ // Always count the slow path as a cache miss since we do not get the benefit of sending only the cache key.
+ stats.recordBlessingCache(false)
// Slowpath, might need to update the cache, or check that the received blessings are
// the same as what's in the cache.
recv, err := security.NewBlessings(*req.Blessings)
@@ -162,10 +164,8 @@
if !reflect.DeepEqual(cached, recv) {
return nil, fmt.Errorf("client sent invalid Blessings")
}
- stats.recordBlessingCache(true)
return cached, nil
}
c.m[req.Key] = recv
- stats.recordBlessingCache(false)
return recv, nil
}