Commit 1003cd92 authored by Andreas Brandl's avatar Andreas Brandl

Add method call count instrumentation

parent 739d6a5a
...@@ -59,12 +59,23 @@ module Routable ...@@ -59,12 +59,23 @@ module Routable
def where_full_path_in(paths) def where_full_path_in(paths)
return none if paths.empty? return none if paths.empty?
increment_full_path_in_counter
wheres = paths.map do |path| wheres = paths.map do |path|
"(LOWER(routes.path) = LOWER(#{connection.quote(path)}))" "(LOWER(routes.path) = LOWER(#{connection.quote(path)}))"
end end
joins(:route).where(wheres.join(' OR ')) joins(:route).where(wheres.join(' OR '))
end end
# Temporary instrumentation of method calls for .where_full_path_in
def increment_full_path_in_counter
@counter ||= Gitlab::Metrics.counter(:routable_caseinsensitive_lookup_calls, 'Number of calls to Routable.where_full_path_in')
@counter.increment
rescue
# ignore the error
end
end end
def full_name def full_name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment