summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-29 16:05:57 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-30 14:45:50 +0200
commit1e0c6ead2c04d5a92f31dfc4dcb48816415d66cb (patch)
treeb3210d23baeb553b376286e5ad6bfde5bfb6e240
parent1a68a0a6f55049b4ad42222b0dc667fe625a7604 (diff)
downloadgitlab-ce-1e0c6ead2c04d5a92f31dfc4dcb48816415d66cb.tar.gz
Instrument cache fetch hit and cache fetch misses
-rw-r--r--lib/gitlab/metrics/subscribers/rails_cache.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/metrics/subscribers/rails_cache.rb b/lib/gitlab/metrics/subscribers/rails_cache.rb
index 8e345e8ae4a..277c860fbef 100644
--- a/lib/gitlab/metrics/subscribers/rails_cache.rb
+++ b/lib/gitlab/metrics/subscribers/rails_cache.rb
@@ -21,6 +21,18 @@ module Gitlab
increment(:cache_exists, event.duration)
end
+ def cache_fetch_hit(event)
+ return unless current_transaction
+
+ current_transaction.increment(:cache_fetch_hit, 1)
+ end
+
+ def cache_generate(event)
+ return unless current_transaction
+
+ current_transaction.increment(:cache_fetch_miss, 1)
+ end
+
def increment(key, duration)
return unless current_transaction