@@ -6,9 +6,9 @@ module Subscribers
6
6
class RailsCache < ActiveSupport ::Subscriber
7
7
attach_to :active_support
8
8
9
- def self . metric_cache_duration_seconds
10
- @metric_cache_duration_seconds ||= Gitlab ::Metrics . histogram (
11
- :gitlab_cache_duration_seconds ,
9
+ def self . metric_cache_operation_duration_seconds
10
+ @metric_cache_operation_duration_seconds ||= Gitlab ::Metrics . histogram (
11
+ :gitlab_cache_operation_duration_seconds ,
12
12
'Cache access time' ,
13
13
{ action : nil , operation : nil } ,
14
14
[ 0.001 , 0.002 , 0.005 , 0.01 , 0.02 , 0.05 , 0.1 , 0.500 , 2.0 , 10.0 ]
@@ -31,10 +31,10 @@ def cache_read(event)
31
31
32
32
if event . payload [ :hit ]
33
33
self . class . metric_cache_read_hit_total . increment ( { action : action } )
34
- current_transaction . increment ( :cache_read_hit_count , 1 )
34
+ current_transaction . increment ( :cache_read_hit_count , 1 , false )
35
35
else
36
36
self . class . metric_cache_read_miss_total . increment ( { action : action } )
37
- current_transaction . increment ( :cache_read_miss_count , 1 )
37
+ current_transaction . increment ( :cache_read_miss_count , 1 , false )
38
38
end
39
39
end
40
40
@@ -67,11 +67,11 @@ def cache_generate(event)
67
67
def observe ( key , duration )
68
68
return unless current_transaction
69
69
70
- self . class . metric_cache_duration_seconds . observe ( { operation : key , action : action } , duration / 1000.0 )
70
+ self . class . metric_cache_operation_duration_seconds . observe ( { operation : key , action : action } , duration / 1000.0 )
71
71
current_transaction . increment ( :cache_duration , duration , false )
72
72
current_transaction . increment ( :cache_count , 1 , false )
73
- current_transaction . increment ( "#{ key } _duration" . to_sym , duration , false )
74
- current_transaction . increment ( "#{ key } _count" . to_sym , 1 , false )
73
+ current_transaction . increment ( "cache_ #{ key } _duration" . to_sym , duration , false )
74
+ current_transaction . increment ( "cache_ #{ key } _count" . to_sym , 1 , false )
75
75
end
76
76
77
77
private
0 commit comments