Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
75635e2b
Commit
75635e2b
authored
May 04, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'add-instrumentation-for-15137' into 'master'
Instrument methods used in email diffs See merge request !4038
parent
213974bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
CHANGELOG
CHANGELOG
+3
-0
config/initializers/metrics.rb
config/initializers/metrics.rb
+22
-15
No files found.
CHANGELOG
View file @
75635e2b
...
...
@@ -2,6 +2,9 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
v 8.7.2
- The "New Branch" button is now loaded asynchronously
- Fix error 500 when trying to create a wiki page
...
...
config/initializers/metrics.rb
View file @
75635e2b
...
...
@@ -61,12 +61,30 @@ if Gitlab::Metrics.enabled?
config
.
instrument_instance_methods
(
const
)
end
Dir
[
Rails
.
root
.
join
(
'app'
,
'finders'
,
'*.rb'
)].
each
do
|
path
|
const
=
File
.
basename
(
path
,
'.rb'
).
camelize
.
constantize
config
.
instrument_instance_methods
(
const
)
# Path to search => prefix to strip from constant
paths_to_instrument
=
{
[
'app'
,
'finders'
]
=>
[
'app'
,
'finders'
],
[
'app'
,
'mailers'
,
'emails'
]
=>
[
'app'
,
'mailers'
],
[
'app'
,
'services'
,
'**'
]
=>
[
'app'
,
'services'
],
[
'lib'
,
'gitlab'
,
'diff'
]
=>
[
'lib'
],
[
'lib'
,
'gitlab'
,
'email'
,
'message'
]
=>
[
'lib'
]
}
paths_to_instrument
.
each
do
|
(
path
,
prefix
)
|
prefix
=
Rails
.
root
.
join
(
*
prefix
)
Dir
[
Rails
.
root
.
join
(
*
path
+
[
'*.rb'
])].
each
do
|
file_path
|
path
=
Pathname
.
new
(
file_path
).
relative_path_from
(
prefix
)
const
=
path
.
to_s
.
sub
(
'.rb'
,
''
).
camelize
.
constantize
config
.
instrument_methods
(
const
)
config
.
instrument_instance_methods
(
const
)
end
end
config
.
instrument_methods
(
Premailer
::
Adapter
::
Nokogiri
)
config
.
instrument_instance_methods
(
Premailer
::
Adapter
::
Nokogiri
)
[
:Blame
,
:Branch
,
:BranchCollection
,
:Blob
,
:Commit
,
:Diff
,
:Repository
,
:Tag
,
:TagCollection
,
:Tree
...
...
@@ -97,17 +115,6 @@ if Gitlab::Metrics.enabled?
config
.
instrument_methods
(
Gitlab
::
ReferenceExtractor
)
config
.
instrument_instance_methods
(
Gitlab
::
ReferenceExtractor
)
# Instrument all service classes
services
=
Rails
.
root
.
join
(
'app'
,
'services'
)
Dir
[
services
.
join
(
'**'
,
'*.rb'
)].
each
do
|
file_path
|
path
=
Pathname
.
new
(
file_path
).
relative_path_from
(
services
)
const
=
path
.
to_s
.
sub
(
'.rb'
,
''
).
camelize
.
constantize
config
.
instrument_methods
(
const
)
config
.
instrument_instance_methods
(
const
)
end
# Instrument the classes used for checking if somebody has push access.
config
.
instrument_instance_methods
(
Gitlab
::
GitAccess
)
config
.
instrument_instance_methods
(
Gitlab
::
GitAccessWiki
)
...
...
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