2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Marginalia
|
2020-03-09 13:42:32 +05:30
|
|
|
cattr_accessor :enabled, default: false
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
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
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
def self.set_enabled_from_feature_flag
|
2020-01-01 13:55:28 +05:30
|
|
|
# During db:create and db:bootstrap skip feature query as DB is not available yet.
|
2020-03-09 13:42:32 +05:30
|
|
|
return false unless Gitlab::Database.cached_table_exists?('features')
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
self.enabled = Feature.enabled?(:marginalia, type: :ops)
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|