Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/marginalia.rb')
-rw-r--r--lib/gitlab/marginalia.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/marginalia.rb b/lib/gitlab/marginalia.rb
new file mode 100644
index 00000000000..2be96cecae3
--- /dev/null
+++ b/lib/gitlab/marginalia.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Marginalia
+ MARGINALIA_FEATURE_FLAG = :marginalia
+
+ 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
+
+ def self.cached_feature_enabled?
+ !!@enabled
+ end
+
+ def self.set_feature_cache
+ # During db:create and db:bootstrap skip feature query as DB is not available yet.
+ return false unless ActiveRecord::Base.connected? && Gitlab::Database.cached_table_exists?('features')
+
+ @enabled = Feature.enabled?(MARGINALIA_FEATURE_FLAG)
+ end
+ end
+end