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

marginalia.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 24e21a1d512e6e2b1269795125a4e89354ff4e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

module Gitlab
  module Marginalia
    cattr_accessor :enabled, default: false

    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 Gitlab::Database.cached_table_exists?('features')

      self.enabled = Feature.enabled?(MARGINALIA_FEATURE_FLAG)
    end
  end
end