Commit c099fa81 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'bjk/routable_counter' into 'master'

Adjust routable metric

See merge request gitlab-org/gitlab-ce!32591
parents 4e9c531a 56c01f62
Pipeline #80434262 passed with stages
in 41 minutes and 59 seconds
......@@ -33,7 +33,7 @@ module Routable
# Returns a single object, or nil.
def find_by_full_path(path, follow_redirects: false)
increment_counter(:routable_find_by_full_path, 'Number of calls to Routable.find_by_full_path')
routable_calls_counter.increment(method: 'find_by_full_path')
if Feature.enabled?(:routable_two_step_lookup)
# Case sensitive match first (it's cheaper and the usual case)
......@@ -61,7 +61,7 @@ module Routable
def where_full_path_in(paths)
return none if paths.empty?
increment_counter(:routable_where_full_path_in, 'Number of calls to Routable.where_full_path_in')
routable_calls_counter.increment(method: 'where_full_path_in')
wheres = do |path|
"(LOWER(routes.path) = LOWER(#{connection.quote(path)}))"
......@@ -71,12 +71,8 @@ module Routable
# Temporary instrumentation of method calls
def increment_counter(counter, description)
@counters[counter] ||= Gitlab::Metrics.counter(counter, description)
# ignore the error
def routable_calls_counter
@routable_calls_counter ||= Gitlab::Metrics.counter(:gitlab_routable_calls_total, 'Number of calls to Routable by method')
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