1136c0c8e9
This adds `rugged_duration_ms` and `rugged_calls` fields to `api_json.log` and `production_json.log`. This will make it easier to identify performance issues caused by excessive I/O. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64676
36 lines
1.1 KiB
Ruby
Executable file
36 lines
1.1 KiB
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
ALLOWED = [
|
|
# Needed to handle repositories that are not in any storage
|
|
'lib/gitlab/bare_repository_import/repository.rb',
|
|
|
|
# Needed to avoid using the git binary to validate a branch name
|
|
'lib/gitlab/git_ref_validator.rb',
|
|
|
|
# Reverted Rugged calls due to Gitaly atop NFS performance
|
|
# See https://docs.gitlab.com/ee/development/gitaly.html#legacy-rugged-code.
|
|
'lib/gitlab/git/rugged_impl/',
|
|
'lib/gitlab/gitaly_client/storage_settings.rb',
|
|
|
|
# Needed for logging
|
|
'config/initializers/lograge.rb',
|
|
'lib/gitlab/grape_logging/loggers/perf_logger.rb',
|
|
'lib/gitlab/rugged_instrumentation.rb'
|
|
].freeze
|
|
|
|
rugged_lines = IO.popen(%w[git grep -i -n rugged -- app config lib], &:read).lines
|
|
rugged_lines = rugged_lines.select { |l| /^[^:]*\.rb:/ =~ l }
|
|
rugged_lines = rugged_lines.reject { |l| l.start_with?(*ALLOWED) }
|
|
rugged_lines = rugged_lines.reject { |l| /(include|prepend) Gitlab::Git::RuggedImpl/ =~ l}
|
|
rugged_lines = rugged_lines.reject do |line|
|
|
code, _comment = line.split('# ', 2)
|
|
code !~ /rugged/i
|
|
end
|
|
|
|
exit if rugged_lines.empty?
|
|
|
|
puts "Using Rugged is only allowed in test and #{ALLOWED}\n\n"
|
|
|
|
puts rugged_lines
|
|
|
|
exit(false)
|