Commit 257d5ebd authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Expand the instrumentation FF coverage

Adding more code under the feature flag which is related to the
Instrumentation intialization and would be removed alongside the code
which is already under the FF.
parent f9651eae
...@@ -162,6 +162,9 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d ...@@ -162,6 +162,9 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
config.middleware.use(Gitlab::Metrics::ElasticsearchRackMiddleware) config.middleware.use(Gitlab::Metrics::ElasticsearchRackMiddleware)
end end
# We are removing the Instrumentation module entirely in steps.
# More in https://gitlab.com/gitlab-org/gitlab/-/issues/217978.
unless ::Feature.enabled?(:method_instrumentation_disable_initialization)
# This instruments all methods residing in app/models that (appear to) use any # This instruments all methods residing in app/models that (appear to) use any
# of the ActiveRecord methods. This has to take place _after_ initializing as # of the ActiveRecord methods. This has to take place _after_ initializing as
# for some unknown reason calling eager_load! earlier breaks Devise. # for some unknown reason calling eager_load! earlier breaks Devise.
...@@ -178,9 +181,6 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d ...@@ -178,9 +181,6 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
ActiveRecord::Querying.public_instance_methods(false).map(&:to_s) ActiveRecord::Querying.public_instance_methods(false).map(&:to_s)
) )
# We are removing the Instrumentation module entirely in steps.
# More in https://gitlab.com/gitlab-org/gitlab/-/issues/217978.
unless ::Feature.enabled?(:method_instrumentation_disable_initialization)
Gitlab::Metrics::Instrumentation Gitlab::Metrics::Instrumentation
.instrument_class_hierarchy(ActiveRecord::Base) do |klass, method| .instrument_class_hierarchy(ActiveRecord::Base) do |klass, method|
# Instrumenting the ApplicationSetting class can lead to an infinite # Instrumenting the ApplicationSetting class can lead to an infinite
...@@ -199,9 +199,7 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d ...@@ -199,9 +199,7 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
# be instrumented. # be instrumented.
Gitlab::Metrics::Instrumentation.instrument_methods(Ability) Gitlab::Metrics::Instrumentation.instrument_methods(Ability)
end end
end
unless ::Feature.enabled?(:method_instrumentation_disable_initialization)
Gitlab::Metrics::Instrumentation.configure do |config| Gitlab::Metrics::Instrumentation.configure do |config|
instrument_classes(config) instrument_classes(config)
end end
......
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