File tree 1 file changed +13
-15
lines changed
elasticsearch-rails/lib/elasticsearch/rails/instrumentation
1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -12,25 +12,23 @@ module SearchRequest
12
12
13
13
def self . included ( base )
14
14
base . class_eval do
15
- alias_method :execute_without_instrumentation! , :execute!
16
-
17
- def execute!
18
- execute_with_instrumentation!
19
- end
20
-
21
- # Wrap `Search#execute!` and perform instrumentation
22
- #
23
- def execute_with_instrumentation!
24
- ActiveSupport ::Notifications . instrument "search.elasticsearch" ,
25
- name : 'Search' ,
26
- klass : ( self . klass . is_a? ( Elasticsearch ::Model ::Proxy ::ClassMethodsProxy ) ? self . klass . target . to_s : self . klass . to_s ) ,
27
- search : self . definition do
28
- execute_without_instrumentation!
29
- end
15
+ unless method_defined? ( :execute_without_instrumentation! )
16
+ alias_method :execute_without_instrumentation! , :execute!
17
+ alias_method :execute! , :execute_with_instrumentation!
30
18
end
31
19
end
32
20
end
33
21
22
+ # Wrap `Search#execute!` and perform instrumentation
23
+ #
24
+ def execute_with_instrumentation!
25
+ ActiveSupport ::Notifications . instrument "search.elasticsearch" ,
26
+ name : 'Search' ,
27
+ klass : ( self . klass . is_a? ( Elasticsearch ::Model ::Proxy ::ClassMethodsProxy ) ? self . klass . target . to_s : self . klass . to_s ) ,
28
+ search : self . definition do
29
+ execute_without_instrumentation!
30
+ end
31
+ end
34
32
end
35
33
end
36
34
end
You can’t perform that action at this time.
0 commit comments