summaryrefslogtreecommitdiff
path: root/lib/gitlab/tracing.rb
blob: 3c4db42ac066807ab8a18d0942f2ea68d67e49c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Gitlab
  module Tracing
    # Only enable tracing when the `GITLAB_TRACING` env var is configured. Note that we avoid using ApplicationSettings since
    # the same environment variable needs to be configured for Workhorse, Gitaly and any other components which
    # emit tracing. Since other components may start before Rails, and may not have access to ApplicationSettings,
    # an env var makes more sense.
    def self.enabled?
      connection_string.present?
    end

    def self.connection_string
      ENV['GITLAB_TRACING']
    end
  end
end