diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-08 18:07:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-08 18:07:32 +0000 |
commit | 73391dcc368ef846c2960c1d0ef5e64ca78e1bee (patch) | |
tree | b111bca95c5a4e45318eb85a238c7916340efff2 /lib | |
parent | a7df1d8717d39424ced032d9fe063f08f97e19d6 (diff) | |
download | gitlab-ce-73391dcc368ef846c2960c1d0ef5e64ca78e1bee.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/sidekiq_logging/structured_logger.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_logging/structured_logger.rb b/lib/gitlab/sidekiq_logging/structured_logger.rb index bcc2e77714d..2baa16abe27 100644 --- a/lib/gitlab/sidekiq_logging/structured_logger.rb +++ b/lib/gitlab/sidekiq_logging/structured_logger.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require 'active_record' +require 'active_record/log_subscriber' + module Gitlab module SidekiqLogging class StructuredLogger @@ -10,6 +13,7 @@ module Gitlab def call(job, queue) started_time = get_time base_payload = parse_job(job) + ActiveRecord::LogSubscriber.reset_runtime Sidekiq.logger.info log_job_start(base_payload) @@ -63,6 +67,9 @@ module Gitlab convert_to_iso8601(payload, DONE_TIMESTAMP_FIELDS) + payload['db_duration'] = ActiveRecord::LogSubscriber.runtime + payload['db_duration_s'] = payload['db_duration'] / 1000 + payload end |