summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-02-11 08:49:20 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-02-11 08:49:20 +0000
commit25af9032750c215860829fecb196da1e1c5ace6b (patch)
tree63519a0a28314d34bdd25096b5297961bf4791cc /lib
parentc71c50e45f921c3f6b7360bb5992dbabba83cf0e (diff)
parent48bcd5248f6c1e8471393fe07ed043c4fefcb7e2 (diff)
downloadgitlab-ce-25af9032750c215860829fecb196da1e1c5ace6b.tar.gz
Merge branch 'an-peek-jaeger' into 'master'
Provide a performance bar link to the Jaeger UI See merge request gitlab-org/gitlab-ce!24902
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/tracing.rb19
-rw-r--r--lib/peek/views/tracing.rb13
2 files changed, 32 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
diff --git a/lib/peek/views/tracing.rb b/lib/peek/views/tracing.rb
new file mode 100644
index 00000000000..0de32a8fdda
--- /dev/null
+++ b/lib/peek/views/tracing.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module Peek
+ module Views
+ class Tracing < View
+ def results
+ {
+ tracing_url: Gitlab::Tracing.tracing_url
+ }
+ end
+ end
+ end
+end