diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-03 07:43:46 +0300 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-03 07:43:46 +0300 |
commit | 594f56e1ef2ea2032728e3288cb9aee6146739fc (patch) | |
tree | 2693e6931c0d918ce2720b863d202bc690a5e22e /lib/gitlab | |
parent | 4e4fcf79c57f9c6f62b7a1cfbb6a83ee154f05fa (diff) | |
parent | 0234795825640022ccd43476e3c679d4e054a46f (diff) |
Merge branch 'an-use-labkit-correlation-id' into 'master'
Remove all references to Gitlab::CorrelationId
See merge request gitlab-org/gitlab-ce!32228
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/correlation_id.rb | 40 | ||||
-rw-r--r-- | lib/gitlab/tracing.rb | 2 |
2 files changed, 1 insertions, 41 deletions
diff --git a/lib/gitlab/correlation_id.rb b/lib/gitlab/correlation_id.rb deleted file mode 100644 index 0f9bde4390e..00000000000 --- a/lib/gitlab/correlation_id.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module CorrelationId - LOG_KEY = 'correlation_id'.freeze - - class << self - def use_id(correlation_id, &blk) - # always generate a id if null is passed - correlation_id ||= new_id - - ids.push(correlation_id || new_id) - - begin - yield(current_id) - ensure - ids.pop - end - end - - def current_id - ids.last - end - - def current_or_new_id - current_id || new_id - end - - private - - def ids - Thread.current[:correlation_id] ||= [] - end - - def new_id - SecureRandom.uuid - end - end - end -end diff --git a/lib/gitlab/tracing.rb b/lib/gitlab/tracing.rb index 29517591c51..7732d7c9d9c 100644 --- a/lib/gitlab/tracing.rb +++ b/lib/gitlab/tracing.rb @@ -30,7 +30,7 @@ module Gitlab # Avoid using `format` since it can throw TypeErrors # which we want to avoid on unsanitised env var input tracing_url_template.to_s - .gsub(/\{\{\s*correlation_id\s*\}\}/, Gitlab::CorrelationId.current_id.to_s) + .gsub(/\{\{\s*correlation_id\s*\}\}/, Labkit::Correlation::CorrelationId.current_id.to_s) .gsub(/\{\{\s*service\s*\}\}/, Gitlab.process_name) end end |