2019-12-13 16:07:41 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Marginalia
|
2020-01-23 10:08:46 -05:00
|
|
|
cattr_accessor :enabled, default: false
|
|
|
|
|
2019-12-13 16:07:41 -05:00
|
|
|
def self.set_application_name
|
|
|
|
::Marginalia.application_name = Gitlab.process_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.enable_sidekiq_instrumentation
|
|
|
|
if Sidekiq.server?
|
|
|
|
::Marginalia::SidekiqInstrumentation.enable!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-14 08:08:58 -04:00
|
|
|
def self.set_enabled_from_feature_flag
|
2019-12-13 16:07:41 -05:00
|
|
|
# During db:create and db:bootstrap skip feature query as DB is not available yet.
|
2020-02-17 19:09:20 -05:00
|
|
|
return false unless Gitlab::Database.cached_table_exists?('features')
|
2019-12-13 16:07:41 -05:00
|
|
|
|
2020-10-15 02:09:14 -04:00
|
|
|
self.enabled = Feature.enabled?(:marginalia, type: :ops)
|
2019-12-13 16:07:41 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|