Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
b7d76186f413
Commit
f2226d59
authored
Aug 29, 2019
by
Andreas Brandl
Browse files
Add method call count instrumentation
parent
637d2d5be403
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/concerns/routable.rb
View file @
b7d76186
...
...
@@ -59,12 +59,23 @@ def find_by_full_path(path, follow_redirects: false)
def
where_full_path_in
(
paths
)
return
none
if
paths
.
empty?
increment_full_path_in_counter
wheres
=
paths
.
map
do
|
path
|
"(LOWER(routes.path) = LOWER(
#{
connection
.
quote
(
path
)
}
))"
end
joins
(
:route
).
where
(
wheres
.
join
(
' OR '
))
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
def
full_name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment