diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 03:08:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 03:08:48 +0300 |
commit | b69f406585ff64b1c5140ebba775cc754fabb358 (patch) | |
tree | 9af7dfeb0c3f0f8db189a6e18c6be398a7729e2d /lib/gitlab/sidekiq_logging | |
parent | 866ca4e49ff74ffadf8e6f6ff663a168489c2aba (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/sidekiq_logging')
-rw-r--r-- | lib/gitlab/sidekiq_logging/structured_logger.rb | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/gitlab/sidekiq_logging/structured_logger.rb b/lib/gitlab/sidekiq_logging/structured_logger.rb index 8e7626b8eb6..6dacca5529b 100644 --- a/lib/gitlab/sidekiq_logging/structured_logger.rb +++ b/lib/gitlab/sidekiq_logging/structured_logger.rb @@ -6,8 +6,6 @@ require 'active_record/log_subscriber' module Gitlab module SidekiqLogging class StructuredLogger - MAXIMUM_JOB_ARGUMENTS_LENGTH = 10.kilobytes - def call(job, queue) started_time = get_time base_payload = parse_job(job) @@ -85,7 +83,7 @@ module Gitlab job['pid'] = ::Process.pid job.delete('args') unless ENV['SIDEKIQ_LOG_ARGUMENTS'] - job['args'] = limited_job_args(job['args']) if job['args'] + job['args'] = Gitlab::Utils::LogLimitedArray.log_limited_array(job['args']) if job['args'] job end @@ -108,21 +106,6 @@ module Gitlab def current_time Gitlab::Metrics::System.monotonic_time end - - def limited_job_args(args) - return unless args.is_a?(Array) - - total_length = 0 - limited_args = args.take_while do |arg| - total_length += arg.to_json.length - - total_length <= MAXIMUM_JOB_ARGUMENTS_LENGTH - end - - limited_args.push('...') if total_length > MAXIMUM_JOB_ARGUMENTS_LENGTH - - limited_args - end end end end |