diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2019-08-26 18:49:58 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2019-08-26 18:49:58 +0200 |
commit | 0234795825640022ccd43476e3c679d4e054a46f (patch) | |
tree | 40dcf635f40662aac46a584ac08fd475f854acd0 /lib | |
parent | 94490b63b3c40af9c73db10161f1f5905165309b (diff) | |
download | gitlab-ce-0234795825640022ccd43476e3c679d4e054a46f.tar.gz |
Remove all references to Gitlab::CorrelationIdan-use-labkit-correlation-id
This class has been replaced with Labkit::Correlation::CorrelationId
Diffstat (limited to 'lib')
-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 |