diff options
author | Pablo Carranza <pcarranza@gmail.com> | 2016-05-15 21:47:41 +0300 |
---|---|---|
committer | Pablo Carranza <pcarranza@gmail.com> | 2016-05-15 21:47:41 +0300 |
commit | b9306c2e82fec5b74416ccdd5481dfed3f8fbf51 (patch) | |
tree | a837614911e44605bd56a98c496545d610250654 /lib/gitlab/metrics/subscribers | |
parent | c3f68b109144dd5152ac169b2f5eca74fae4d5a2 (diff) |
Add cache count metrics to rails cache
Diffstat (limited to 'lib/gitlab/metrics/subscribers')
-rw-r--r-- | lib/gitlab/metrics/subscribers/rails_cache.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gitlab/metrics/subscribers/rails_cache.rb b/lib/gitlab/metrics/subscribers/rails_cache.rb index 49e5f86e6e6..8e345e8ae4a 100644 --- a/lib/gitlab/metrics/subscribers/rails_cache.rb +++ b/lib/gitlab/metrics/subscribers/rails_cache.rb @@ -6,26 +6,28 @@ module Gitlab attach_to :active_support def cache_read(event) - increment(:cache_read_duration, event.duration) + increment(:cache_read, event.duration) end def cache_write(event) - increment(:cache_write_duration, event.duration) + increment(:cache_write, event.duration) end def cache_delete(event) - increment(:cache_delete_duration, event.duration) + increment(:cache_delete, event.duration) end def cache_exist?(event) - increment(:cache_exists_duration, event.duration) + increment(:cache_exists, event.duration) end def increment(key, duration) return unless current_transaction current_transaction.increment(:cache_duration, duration) - current_transaction.increment(key, duration) + current_transaction.increment(:cache_count, 1) + current_transaction.increment("#{key}_duration".to_sym, duration) + current_transaction.increment("#{key}_count".to_sym, 1) end private |