2019-12-13 21:07:41 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Marginalia
|
2020-01-23 15:08:46 +00:00
|
|
|
cattr_accessor :enabled, default: false
|
|
|
|
|
2019-12-13 21:07:41 +00: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 12:08:58 +00:00
|
|
|
def self.set_enabled_from_feature_flag
|
2019-12-13 21:07:41 +00:00
|
|
|
# During db:create and db:bootstrap skip feature query as DB is not available yet.
|
2020-02-18 00:09:20 +00:00
|
|
|
return false unless Gitlab::Database.cached_table_exists?('features')
|
2019-12-13 21:07:41 +00:00
|
|
|
|
2020-10-15 06:09:14 +00:00
|
|
|
self.enabled = Feature.enabled?(:marginalia, type: :ops)
|
2019-12-13 21:07:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|