Commit 917c26ce authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'add-instrumentation-for-15137' into 'master'

Instrument methods used in email diffs

See merge request !4038
parents b9d9a4d2 f660b217
...@@ -18,6 +18,9 @@ v 8.8.0 (unreleased) ...@@ -18,6 +18,9 @@ v 8.8.0 (unreleased)
- Added multiple colors for labels in dropdowns when dups happen. - Added multiple colors for labels in dropdowns when dups happen.
- Improve description for the Two-factor Authentication sign-in screen. (Connor Shea) - Improve description for the Two-factor Authentication sign-in screen. (Connor Shea)
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
v 8.7.2 v 8.7.2
- The "New Branch" button is now loaded asynchronously - The "New Branch" button is now loaded asynchronously
- Fix error 500 when trying to create a wiki page - Fix error 500 when trying to create a wiki page
......
...@@ -61,12 +61,30 @@ if Gitlab::Metrics.enabled? ...@@ -61,12 +61,30 @@ if Gitlab::Metrics.enabled?
config.instrument_instance_methods(const) config.instrument_instance_methods(const)
end end
Dir[Rails.root.join('app', 'finders', '*.rb')].each do |path| # Path to search => prefix to strip from constant
const = File.basename(path, '.rb').camelize.constantize paths_to_instrument = {
['app', 'finders'] => ['app', 'finders'],
config.instrument_instance_methods(const) ['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 end
config.instrument_methods(Premailer::Adapter::Nokogiri)
config.instrument_instance_methods(Premailer::Adapter::Nokogiri)
[ [
:Blame, :Branch, :BranchCollection, :Blob, :Commit, :Diff, :Repository, :Blame, :Branch, :BranchCollection, :Blob, :Commit, :Diff, :Repository,
:Tag, :TagCollection, :Tree :Tag, :TagCollection, :Tree
...@@ -97,17 +115,6 @@ if Gitlab::Metrics.enabled? ...@@ -97,17 +115,6 @@ if Gitlab::Metrics.enabled?
config.instrument_methods(Gitlab::ReferenceExtractor) config.instrument_methods(Gitlab::ReferenceExtractor)
config.instrument_instance_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. # Instrument the classes used for checking if somebody has push access.
config.instrument_instance_methods(Gitlab::GitAccess) config.instrument_instance_methods(Gitlab::GitAccess)
config.instrument_instance_methods(Gitlab::GitAccessWiki) config.instrument_instance_methods(Gitlab::GitAccessWiki)
......
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