Always load the metrics the last

Because this could potentially load a model and we shouldn't
load models before all the patches we have in places.
This commit is contained in:
Lin Jen-Shin 2018-12-20 23:07:26 +08:00
parent 24c9e1e2a8
commit 77b8c2c176
3 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,6 @@
# This file was prefixed with zz_ because we want to load it the last!
# See: https://gitlab.com/gitlab-org/gitlab-ce/issues/55611
# Autoload all classes that we want to instrument, and instrument the methods we # Autoload all classes that we want to instrument, and instrument the methods we
# need. This takes the Gitlab::Metrics::Instrumentation module as an argument so # need. This takes the Gitlab::Metrics::Instrumentation module as an argument so
# that we can stub it for testing, as it is only called when metrics are # that we can stub it for testing, as it is only called when metrics are

View File

@ -35,7 +35,7 @@ Using this method is in general preferred over directly calling the various
instrumentation methods. instrumentation methods.
Method instrumentation should be added in the initializer Method instrumentation should be added in the initializer
`config/initializers/8_metrics.rb`. `config/initializers/zz_metrics.rb`.
### Examples ### Examples

View File

@ -16,7 +16,7 @@ describe 'instrument_classes' do
end end
it 'can autoload and instrument all files' do it 'can autoload and instrument all files' do
require_relative '../../config/initializers/8_metrics' require_relative '../../config/initializers/zz_metrics'
expect { instrument_classes(config) }.not_to raise_error expect { instrument_classes(config) }.not_to raise_error
end end
end end