summaryrefslogtreecommitdiff
path: root/lib/gitlab/sidekiq_logging/json_formatter.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /lib/gitlab/sidekiq_logging/json_formatter.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'lib/gitlab/sidekiq_logging/json_formatter.rb')
-rw-r--r--lib/gitlab/sidekiq_logging/json_formatter.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_logging/json_formatter.rb b/lib/gitlab/sidekiq_logging/json_formatter.rb
index 45c6842c59b..64782e1e1d1 100644
--- a/lib/gitlab/sidekiq_logging/json_formatter.rb
+++ b/lib/gitlab/sidekiq_logging/json_formatter.rb
@@ -19,6 +19,7 @@ module Gitlab
output[:message] = data
when Hash
convert_to_iso8601!(data)
+ convert_retry_to_integer!(data)
stringify_args!(data)
output.merge!(data)
end
@@ -41,6 +42,20 @@ module Gitlab
Time.at(timestamp).utc.iso8601(3)
end
+ def convert_retry_to_integer!(payload)
+ payload['retry'] =
+ case payload['retry']
+ when Integer
+ payload['retry']
+ when false, nil
+ 0
+ when true
+ Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS
+ else
+ -1
+ end
+ end
+
def stringify_args!(payload)
payload['args'] = Gitlab::Utils::LogLimitedArray.log_limited_array(payload['args'].map(&:to_s)) if payload['args']
end