diff options
Diffstat (limited to 'lib/gitlab/tracing.rb')
-rw-r--r-- | lib/gitlab/tracing.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/tracing.rb b/lib/gitlab/tracing.rb index 3c4db42ac06..0d9b0be1c8e 100644 --- a/lib/gitlab/tracing.rb +++ b/lib/gitlab/tracing.rb @@ -13,5 +13,24 @@ module Gitlab def self.connection_string ENV['GITLAB_TRACING'] end + + def self.tracing_url_template + ENV['GITLAB_TRACING_URL'] + end + + def self.tracing_url_enabled? + enabled? && tracing_url_template.present? + end + + # This will provide a link into the distributed tracing for the current trace, + # if it has been captured. + def self.tracing_url + return unless tracing_url_enabled? + + tracing_url_template % { + correlation_id: Gitlab::CorrelationId.current_id.to_s, + service: Gitlab.process_name + } + end end end |