Add metrics to the RepositoryCacheAdapter
To be able to appropriately size the new Redis cluster, we should have some idea of the traffic it would be serving. We should try to have the following in metrics:
repository_cache_read_bytesrepository_cache_write_bytesrepository_cache_read_countrepository_cache_write_countrepository_cache_hits_totalrepository_cache_read_total
Ideally, we'd also able the read- and write-count with the actual redis command, but that might not be straightforward in all cases. Most of this uses an ActiveSupport::Cache::RedisCacheStore (Rails.cache). I'd consider this nice-to-have.
We have also enabled caching for everything that passes through this class. So we should make sure we get the real size (after compression) for the read- and write- bytes metrics.
There are 3 classes that are used from RepositoryCacheAdapter:
-
RepositoryCache: for most methods. This instance can haveRails.cacheas a backend as well asGitlab::SafeRequestStore. We only need data from theRails.cachebackend -
RepositoryHashCache: This is always backed byGitlab::Redis::Cache. This class already has some metrics being emitted. It stores values in Redis -
RepositorySetCache: This is always backed byGitlab::Redis::Cache.
Edited by Bob Van Landuyt