diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /config/initializers/zz_metrics.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'config/initializers/zz_metrics.rb')
-rw-r--r-- | config/initializers/zz_metrics.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/config/initializers/zz_metrics.rb b/config/initializers/zz_metrics.rb index 430e4d60d61..7da1779f87b 100644 --- a/config/initializers/zz_metrics.rb +++ b/config/initializers/zz_metrics.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was prefixed with zz_ because we want to load it the last! # See: https://gitlab.com/gitlab-org/gitlab-foss/issues/55611 @@ -88,6 +90,7 @@ def instrument_classes(instrumentation) instrumentation.instrument_methods(Gitlab::Highlight) instrumentation.instrument_instance_methods(Gitlab::Highlight) + instrumentation.instrument_instance_method(Gitlab::Ci::Config::Yaml::Tags::Resolver, :to_hash) Gitlab.ee do instrumentation.instrument_instance_methods(Elastic::Latest::GitInstanceProxy) @@ -154,9 +157,13 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d # of the ActiveRecord methods. This has to take place _after_ initializing as # for some unknown reason calling eager_load! earlier breaks Devise. Gitlab::Application.config.after_initialize do - Rails.application.eager_load! + # We should move all the logic of this file to somewhere else + # and require it after `Rails.application.initialize!` in `environment.rb` file. + models_path = Rails.root.join('app', 'models').to_s - models = Rails.root.join('app', 'models').to_s + Dir.glob("**/*.rb", base: models_path).sort.each do |file| + require_dependency file + end regex = Regexp.union( ActiveRecord::Querying.public_instance_methods(false).map(&:to_s) @@ -172,7 +179,7 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d else loc = method.source_location - loc && loc[0].start_with?(models) && method.source =~ regex + loc && loc[0].start_with?(models_path) && method.source =~ regex end end @@ -202,4 +209,8 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d class ::Redis::Client prepend TrackNewRedisConnections end + + Labkit::NetHttpPublisher.labkit_prepend! + Labkit::ExconPublisher.labkit_prepend! + Labkit::HTTPClientPublisher.labkit_prepend! end |